I have following macro in Excel 2003:
Sub Macro102()
Workbooks.Open Filename:= _
"C:\Test Histogram.xls"
Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$A$1:$A$10"), _
ActiveSheet.Range("$C$1"), , False, False, True, False
End Sub
When running this macro manually from XL works fine. Now I have a script designed for automation purposes:
'Open an instance of Excel
Set objExcel=CreateObject("Excel.Application")
objExcel.Visible=True
'Open PERSONAL.XLS file
Set objWorkbook=objExcel.Workbooks.Open("C:\Documents and Settings\ctimot\Application Data\Microsoft\" & _
"Excel\XLSTART\PERSONAL.XLS")
'Call macro
objExcel.Run "PERSONAL.XLS!Macro102"
'Close the instance of Excel
objExcel.Quit
Set objExcel=Nothing
The issue is that this scripts stops at the following line from Macro102:
Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$A$1:$A$10"), _
ActiveSheet.Range("$C$1"), , False, False, True, False
with the following error:
Run time error '1004':
The macro " cannot be found.
What could be wrong here? I have atpvbaen listed in VBA Project as atpvbaen.xls (ATPVBAEN.XLA).
Sub Macro102()
Workbooks.Open Filename:= _
"C:\Test Histogram.xls"
Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$A$1:$A$10"), _
ActiveSheet.Range("$C$1"), , False, False, True, False
End Sub
When running this macro manually from XL works fine. Now I have a script designed for automation purposes:
'Open an instance of Excel
Set objExcel=CreateObject("Excel.Application")
objExcel.Visible=True
'Open PERSONAL.XLS file
Set objWorkbook=objExcel.Workbooks.Open("C:\Documents and Settings\ctimot\Application Data\Microsoft\" & _
"Excel\XLSTART\PERSONAL.XLS")
'Call macro
objExcel.Run "PERSONAL.XLS!Macro102"
'Close the instance of Excel
objExcel.Quit
Set objExcel=Nothing
The issue is that this scripts stops at the following line from Macro102:
Application.Run "ATPVBAEN.XLA!Histogram", ActiveSheet.Range("$A$1:$A$10"), _
ActiveSheet.Range("$C$1"), , False, False, True, False
with the following error:
Run time error '1004':
The macro " cannot be found.
What could be wrong here? I have atpvbaen listed in VBA Project as atpvbaen.xls (ATPVBAEN.XLA).