I have some VBA code that exports a query to Excel and then is trying to call and Excel macro in the Personal.xls file to format the spreadsheet.
I open the spreadsheet fine but get a message saying it cannot find the macro. when check the opened personal.xls file in Excel not all of the macros in the file are listed.
If I open the spreadsheet directly the personal.xls show all the macros
For some reason if the Personal.xls is opened remotely not all the macro are available/displayed
Any ideas
Code Below
Private Sub Command12_Click()
On Error GoTo LastLine
DoCmd.OutputTo acOutputQuery, "supplier gate call", acFormatXLS, _
"c:\documents and settings\802284714\My Documents\PC Data\Supplier Gate Call.xls", False
Dim xlObj
Set xlObj = CreateObject("excel.application")
xlObj.Visible = True
xlObj.Workbooks.Open "C:\documents and settings\802284714\My Documents\PC Data\Documents and Settings\Excel\XLSTART\personal.xls"
xlObj.Workbooks.Open "c:\documents and settings\802284714\My Documents\PC Data\Supplier Gate Call.xls"
xlObj.Run "personal.xls!sgc"
'Your recorded macro code code ends here
xlObj.activeworkbook.Save
xlObj.activeworkbook.Close
xlObj.Quit
Exit Sub
LastLine:
MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub
I open the spreadsheet fine but get a message saying it cannot find the macro. when check the opened personal.xls file in Excel not all of the macros in the file are listed.
If I open the spreadsheet directly the personal.xls show all the macros
For some reason if the Personal.xls is opened remotely not all the macro are available/displayed
Any ideas
Code Below
Private Sub Command12_Click()
On Error GoTo LastLine
DoCmd.OutputTo acOutputQuery, "supplier gate call", acFormatXLS, _
"c:\documents and settings\802284714\My Documents\PC Data\Supplier Gate Call.xls", False
Dim xlObj
Set xlObj = CreateObject("excel.application")
xlObj.Visible = True
xlObj.Workbooks.Open "C:\documents and settings\802284714\My Documents\PC Data\Documents and Settings\Excel\XLSTART\personal.xls"
xlObj.Workbooks.Open "c:\documents and settings\802284714\My Documents\PC Data\Supplier Gate Call.xls"
xlObj.Run "personal.xls!sgc"
'Your recorded macro code code ends here
xlObj.activeworkbook.Save
xlObj.activeworkbook.Close
xlObj.Quit
Exit Sub
LastLine:
MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub