Hi there .. any help highly appreciated. Maybe I am just too blind to see it and it is very simple - I actually think it should be.
I have written an import program that opens an excel file, displays the sheets and lets the user choose one. The Excel sheet is quite complex so I had to write my own procedure.
The program then checks the plausibility of the data in the Excel worksheet and if everything is correct, imports. If not, it shows a message, writes a textfile, asks the user to fix the sheet, and stops. BUT the file is still locked. And I cannot figure out how to close the worksheet, workbook, excel application so that it actually works. I always get "file is locked by ..."
I created a couple of variables
Public objExcel As Excel.Application
Public objBook As Excel.Workbook
Public objSheet As Excel.Worksheet
then ask whether for example objBook exists and simply say: objBook.Close
Could someone please point out to me how to do it? :banghead:
I have written an import program that opens an excel file, displays the sheets and lets the user choose one. The Excel sheet is quite complex so I had to write my own procedure.
The program then checks the plausibility of the data in the Excel worksheet and if everything is correct, imports. If not, it shows a message, writes a textfile, asks the user to fix the sheet, and stops. BUT the file is still locked. And I cannot figure out how to close the worksheet, workbook, excel application so that it actually works. I always get "file is locked by ..."
I created a couple of variables
Public objExcel As Excel.Application
Public objBook As Excel.Workbook
Public objSheet As Excel.Worksheet
then ask whether for example objBook exists and simply say: objBook.Close
Could someone please point out to me how to do it? :banghead: