Thread: Run macro
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SkylineGTR[_3_] SkylineGTR[_3_] is offline
external usenet poster
 
Posts: 1
Default Run macro

Hi,

I have a macro in one workbook, that takes two parameters. For the
sake of clarity, something like this:

public sub TEST(pParam1 as string , pParam2 as string)
Debug.print pParam1 & "," & pParam2
end sub

In another workbook, I want to be able to:

1. Start a separate instance of Excel
2. Open the workbook.
3. Run TEST and pass in parameters

I thought that ShellExecute might do the trick, as it has a
"parameters" parameters - I thought this might be rather like the
SubAddress named parameters for Application.FollowHyperlink.
Incidentally, that works:

Application.FollowHyperlink
Address:="c:\FileToLoad.xls",SubAddress:="ThisWork book.TEST(""param1"",""param2"")"

but I want a new instance of Excel, which this does not do.

Any ideas/help anyone?