I'm trying to manipulate Excel 2000 workbooks using little executables I'm creating in VB6. I can open, manipulate and save the spreadsheets with out any problems, but I cannot seem to close Excel, even after I've written the code to close out of Excel. I know this because when I press Ctl+Alt+Del after running my program, there is an instance of Excel running.
The code below is the code I've used to open and close an Excel workbook. If anyone else has had this problem and can help me out it would be much appreciated.
Dim xlApp As Excel.Application
Dim wrkBook As Excel.Workbook
Dim wrkSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set wrkBook = xlApp.Workbooks.Open("C:\anyFile.xls"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
...
wrkBook.Close
xlApp.Quit
Set wrkSheet = Nothing
Set wrkBook = Nothing
Set xlApp = Nothing
P.S. The funny thing is, if I try to create a new workbook instead of opening one, i.e. using
Set wrkBook = xlApp.Workbooks.Add
it works fine, and Excel closes at the end.
The code below is the code I've used to open and close an Excel workbook. If anyone else has had this problem and can help me out it would be much appreciated.
Dim xlApp As Excel.Application
Dim wrkBook As Excel.Workbook
Dim wrkSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application"
Set wrkBook = xlApp.Workbooks.Open("C:\anyFile.xls"
...
wrkBook.Close
xlApp.Quit
Set wrkSheet = Nothing
Set wrkBook = Nothing
Set xlApp = Nothing
P.S. The funny thing is, if I try to create a new workbook instead of opening one, i.e. using
Set wrkBook = xlApp.Workbooks.Add
it works fine, and Excel closes at the end.