Excel to NF

My Problem is the following: I’ve declared some variables: xlapp : ‘Microsoft Excel 8.0 Object Library’.Application xlbook : ‘Microsoft Excel 8.0 Object Library’._Workbook xksheet : ‘Microsoft Excel 8.0 Object Library’._Worksheet Then i use the following code to read data from Excel to Navision: clear(xlapp); clear(xlbook); clear(xlsheet); create(xlapp); xlbook := xlapp.Workbooks.Open(); xlsheet := xlapp.ActiveSheet; xlapp.Visible := TRUE; … … xlapp.Visible := FALSE; clear(xlapp); clear(xlbook); clear(xlsheet); But after the code has finished the Excel-file can’t be opened by Excel. Sometimes it is possible, but only writeprotected. After closing the Navision-session everthing is ok. What is my mistake? Regards Frank

What about xlbook.close at the end? Regards Gudmundur Petursson

That’s it!!! Thanks a lot, Gudmundur. Greetings Frank

… or even better: xlbook.Close(FALSE); xlApp.Quit; Do not use >xlbook.Visible := false< at the end of the processing. Excel will stay active in the background but be unreacheable through the taskbar!! the Visible := false is usefull in the BEGINNING of an processing. For example if you write large amounts of data into a worksheet, Excel will show every single change like if you would fill out the worksheet manually. Setting Excel invisible prior to populating the sheet increases the performance and saves about 40% time. Marcus Fabian ---------------------------------- fabian@ddag.ch m.fabian@thenet.ch 079 439 78 72 ----------------------------------