D
Dan
Hi,
I am trying open an excel spreadsheet from access vba and
run the excel's macro, but I get on error on the part of
running the macro. Currently I have:
....
Dim exap As New Excel.Application
Dim exwb As Excel.Workbook
Dim exws As Excel.Worksheet
Dim excelbook As String
Dim path As String
excelbook = "Book1.xls"
path = CurrentProject.Path & "\" & excelbook
exap.Workbooks.Open path
Set exwb = exap.Workbooks(excelbook)
Set exws = exwb.ActiveSheet
exap.Run("Book1.xls!Macro1") '<----Can not execute this
line of code.
Set exws = Nothing
Set exwb = Nothing
Set exap = Nothing
Is there any other way to execute a macro from access?
I know that if I wanted to run the macro from excel vba
that line would be Application.Run("Book1.xls!Macro1").
Any help would be appreciated.
Thank you.
I am trying open an excel spreadsheet from access vba and
run the excel's macro, but I get on error on the part of
running the macro. Currently I have:
....
Dim exap As New Excel.Application
Dim exwb As Excel.Workbook
Dim exws As Excel.Worksheet
Dim excelbook As String
Dim path As String
excelbook = "Book1.xls"
path = CurrentProject.Path & "\" & excelbook
exap.Workbooks.Open path
Set exwb = exap.Workbooks(excelbook)
Set exws = exwb.ActiveSheet
exap.Run("Book1.xls!Macro1") '<----Can not execute this
line of code.
Set exws = Nothing
Set exwb = Nothing
Set exap = Nothing
Is there any other way to execute a macro from access?
I know that if I wanted to run the macro from excel vba
that line would be Application.Run("Book1.xls!Macro1").
Any help would be appreciated.
Thank you.