I'm trying to get this code to work in the "on Click" Event for a button, but I get this error:
Filename or class name not found during Automation operation
This is the code:
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim xlsApp As Excel.Application
Dim xlswkb As Excel.Workbook
Set xlsApp = CreateObject("Excel.Application")
Set xlswkb = GetObject("C:\Personal.XLS")
xlsApp.Application.Run "PERSONAL.XLS!FILEOPEN2"
xlsApp.Quit
Dim stDocName As String
stDocName = "FULL INTRANSIT Report"
DoCmd.OpenReport stDocName, acNormal
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
The code is supposed to go into the Personal.xls file to run the specified Macro code.
Any help is appreciated
Ziggy
Filename or class name not found during Automation operation
This is the code:
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim xlsApp As Excel.Application
Dim xlswkb As Excel.Workbook
Set xlsApp = CreateObject("Excel.Application")
Set xlswkb = GetObject("C:\Personal.XLS")
xlsApp.Application.Run "PERSONAL.XLS!FILEOPEN2"
xlsApp.Quit
Dim stDocName As String
stDocName = "FULL INTRANSIT Report"
DoCmd.OpenReport stDocName, acNormal
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
The code is supposed to go into the Personal.xls file to run the specified Macro code.
Any help is appreciated
Ziggy