Hi,
i am running a script from a button is pressed to import 36,000 records from an excel spreadsheet - that works fine, however I can not get excel to close completly when finished - i have searched the forum and the internet I havetried different bits of code but none seem to work,open taskmanager and it is still there. I have tried it on 2 differnt PC's to no avail can anyone suggest a sure fire way of getting excel closed - here is the code:
Private Sub Update_Holidays_Click()
On Error GoTo Err_Update_Holidays_Click
' Declare object variables.
Dim appXl As Excel.Application
Dim wrkFile As Workbooks
Dim wrkSheet As Worksheets
' Set object variables.
Set appXl = New Excel.Application
Set wrkFile = appXl.Workbooks
' opens workbook
wrkFile.Open "c:\DriverControl\Holiday2006-2007.xls"
appXl.Visible = False
' deletes existing imported holidays table
DoCmd.DeleteObject acTable, "Imported Holidays"
' deletes access_feed table then transfers spreadsheet to new access feed table
DoCmd.RunMacro "import2"
' filters unused records and creates new imported holidays table
DoCmd.OpenQuery "Imported Holidays Builder"
wrkSheet.Close
wrkFile.Close
appXl.Quit
' Close the object references.
Set wrkSheet = Nothing
Set wrkFile = Nothing
Set appXl = Nothing
Err_Update_Holidays_Click:
' MsgBox Err.Description
' Resume Exit_Update_Holidays_Click
MsgBox "Import Complete"
End Sub
this really is causing me major problems as the imported data is reworked in access and exported to another excel spreadsheet which then falls over with an out of memory error. I can't move the whole lot to access as the excel spreadsheets are in daily use and have to be used - I have spent weeks on this trying various methods and nothing seems to work.
thanks Dean
i am running a script from a button is pressed to import 36,000 records from an excel spreadsheet - that works fine, however I can not get excel to close completly when finished - i have searched the forum and the internet I havetried different bits of code but none seem to work,open taskmanager and it is still there. I have tried it on 2 differnt PC's to no avail can anyone suggest a sure fire way of getting excel closed - here is the code:
Private Sub Update_Holidays_Click()
On Error GoTo Err_Update_Holidays_Click
' Declare object variables.
Dim appXl As Excel.Application
Dim wrkFile As Workbooks
Dim wrkSheet As Worksheets
' Set object variables.
Set appXl = New Excel.Application
Set wrkFile = appXl.Workbooks
' opens workbook
wrkFile.Open "c:\DriverControl\Holiday2006-2007.xls"
appXl.Visible = False
' deletes existing imported holidays table
DoCmd.DeleteObject acTable, "Imported Holidays"
' deletes access_feed table then transfers spreadsheet to new access feed table
DoCmd.RunMacro "import2"
' filters unused records and creates new imported holidays table
DoCmd.OpenQuery "Imported Holidays Builder"
wrkSheet.Close
wrkFile.Close
appXl.Quit
' Close the object references.
Set wrkSheet = Nothing
Set wrkFile = Nothing
Set appXl = Nothing
Err_Update_Holidays_Click:
' MsgBox Err.Description
' Resume Exit_Update_Holidays_Click
MsgBox "Import Complete"
End Sub
this really is causing me major problems as the imported data is reworked in access and exported to another excel spreadsheet which then falls over with an out of memory error. I can't move the whole lot to access as the excel spreadsheets are in daily use and have to be used - I have spent weeks on this trying various methods and nothing seems to work.
thanks Dean
Last edited: