View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson[_2_] Myrna Larson[_2_] is offline
external usenet poster
 
Posts: 124
Default access 97 to excel 97: execute macro automation

Also, he didn't open a workbook -- either the one specified in strwks or any other workbook.


On 13 Jul 2003 19:18:00 -0700, (TC) wrote:

(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