View Single Post
  #1   Report Post  
Posted to comp.databases.ms-access,microsoft.public.excel.programming
TC[_3_] TC[_3_] is offline
external usenet poster
 
Posts: 2
Default access 97 to excel 97: execute macro automation

(JMCN) wrote in message . com...
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



You put the worksheet filename into strwks, but then, you don't do
anything with that variable! Excell will not see it by magic. So
Excell has no idea what worksheet you're talking about.

HTH,
TC