Hi All Does anyone have any experience writing Excel spreadsheets using Microsoft.Jet.OLEDB (ADO) ??
I have inherited some D7 code which copies an Excel template file then attempts to add rows to it using this code ... (I have stripped this down to the essentials to reveal the important lines) (btw - this is on windows XP Pro - latest updates plus Excel is running but no files open) FileCopy('TAD Order TEMPLATE.xls', xl_file); // xl_file is the output filename // set up ADO connection to spreadsheet ADOInput.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+ 'Data Source=[FILENAME];Mode=ReadWrite;'+ 'Extended Properties="Excel 8.0; HDR=NO; IMEX=2;";'+ 'Persist Security Info=False'; // code omitted that inserts the contents of 'xl_file' for [FILENAME] ADOInput.Active := True; ADOInput.Open; // put in a little header to file which should be open to accept them with ADOInput do begin Insert; FieldByName('F1').AsString := ' '; Post; Insert; FieldByName('F1').AsString := 'Order for '+ this_regnum +' / '+ this_id + ' ' + this_person + ' ('+ this_name +')'; Post; Insert; FieldByName('F1').AsString := ' '; Post; // Close now to see what we have in the file ADOInput.Active := False; ADOInput.Close; // under normal execution additional rows are added before closure (at least the code operates with no error messages) The file xl_file should now be the closed with the addition of 3 extra rows BUT The file is still open and the additional rows have not been written to the file, could be buffered (?) Any bright ideas, obvious stuff I have overlooked, etc etc. On a deadlihere so any assistance very much appreciated. Regards Graham Marsden _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe