johnny2bad
Programmer
I am exporting a VSFlexGrid to a temp.xls file, then opening it in VB6, formating the workbook as needed. Then I am doing a saveas to save the excel file in the user's desired location. Everything works fine, until i run the process again. It seems that an instance of EXCEL.EXE is still running in memory. You can end it in the task manager and all is well again. But the next time you run the process the same thing happens.
I have found numerous posts about this same issue yet none have provided a solution. If i run the following code and remark out all of the workbook formating (the whole reason for this proccess) then everything runs perfectly and all processes close. but as soon as you change one cell in the workbook, excel will not close. Any ideas?
Dim XLApp As Excel.Application
Set XLApp = CreateObject("Excel.Application"
Set XLBook = XLApp.Workbooks.Open(InstallPath & "temp\temp.xls"
XLApp.Application.Visible = False
XLApp.Application.DisplayAlerts = False
'------------------------------
'Format cells/columns/rows of Workbook
'------------------------------
XLBook.SaveAs FileName:=FilePathName _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
XLBook.Close True
XLApp.Application.Quit
Set XLBook = Nothing
Set XLApp = Nothing
Thanks in advance!
John
I have found numerous posts about this same issue yet none have provided a solution. If i run the following code and remark out all of the workbook formating (the whole reason for this proccess) then everything runs perfectly and all processes close. but as soon as you change one cell in the workbook, excel will not close. Any ideas?
Dim XLApp As Excel.Application
Set XLApp = CreateObject("Excel.Application"
Set XLBook = XLApp.Workbooks.Open(InstallPath & "temp\temp.xls"
XLApp.Application.Visible = False
XLApp.Application.DisplayAlerts = False
'------------------------------
'Format cells/columns/rows of Workbook
'------------------------------
XLBook.SaveAs FileName:=FilePathName _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
XLBook.Close True
XLApp.Application.Quit
Set XLBook = Nothing
Set XLApp = Nothing
Thanks in advance!
John