Help!!!!!
I have an application that loads an excel spreadsheet and transfers the
data from it to a sql server database. This part of the program works
wonderfully.
The problem is that the excel spreadsheet does not close even after the
application is shut down.
It continues to run in the background and keeps the worksheet open.
Here is the code I use to load the excel spreadsheet, it is activated by
a click event from a button.
Dim EXELAPT As excel.Application
USERFILE = "F:\SPECS\PRODUCTION\" & intfindno & ".XLS"
'USERFILE = "F:\SPECS\PRODUCTION\" & Me!FINDNO.Value & ".XLS"
ROW = "B179"
Set EXELAPT = CreateObject("EXCEL.APPLICATION")
Set MYBOOK = Workbooks.Open(FileName:=USERFILE)
EXELAPT.Workbooks.Open USERFILE
EXELAPT.Visible = True
EXELAPT.Worksheets("shop spec").Select
EXELAPT.Range(ROW).Select
EXELAPT.ActiveCell.FormulaR1C1 = "=NUMBER"
If IsError(ActiveCell) = True Then GoTo 2
adosecondaryrs.Fields("spec_list_job") = Range(ROW)
After all of the data is transfered I update the recordset and then
close the excel application. This works for all the next spreadsheets
that I open but not for the first one.
Here is the code I use to close the excel application:
Set EXELAPT = Nothing
Set MYBOOK = Nothing
2770 EXELAPT.Application.Quit
EXELAPT.Application.Kill
excel.Application.Quit
excel.Application.Kill
Set EXELAPT = Nothing
Set MYBOOK = Nothing
I had the same problem in an Access aplication I wrote using vba but
resolved the problem by inserting an "end" statement.
I don't want to do that here, because I do not want to terminate the
vb
application.
Also is there any way to load an excel spreadsheet as a file and not as
a spreadsheet? This might fix the problem out right.
Thank you for your time, it is much appreciated.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!