ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   access 97 to excel 97: execute macro automation (https://www.excelbanter.com/excel-programming/271537-re-access-97-excel-97-execute-macro-automation.html)

Tom Ogilvy

access 97 to excel 97: execute macro automation
 
Assuming macro1 is a vba macro rather than a Excel4 style macro on an Excel4
macro sheet change this line

appExcel.ExecuteExcel4Macro "Macro1"

to

appExcel.Run "macro-test.xls!Macro1"

Regards,
Tom Ogilvy


JMCN wrote in message
om...
hello

i am trying to open an excel worksheet and excute a macro. i am able
to launch excel but i cannot execute the macro(s). why? what did i
leave out? should i create a getobject function? suggestions would be
appreciated:)
thanks jung

here is the code.

Public Sub LaunchExcel()
Dim appExcel As Excel.Application, strwks As String
Set appExcel = CreateObject("Excel.Application")
Msg "Excel is running"
appExcel.Visible = True
strwks = "c:\Program Files\Microsoft Office\Office\"
strwks = strwks & "macro-test.xls"
appExcel.ExecuteExcel4Macro "Macro1"
Set appExcel = Nothing
End Sub





All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com