View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
gerdmain gerdmain is offline
external usenet poster
 
Posts: 13
Default Run excel macro on one xls from another xls

Hi Kishore Shenoi,

In Macro2 use the command
Application.Run "A.xls!Macro1"

If the name of the macro (say Macro1) is stored on the active sheet in
B.xls, say in A1, you can read it into a VBA variable (say MName), append the
workbook name and then run it like this:

MName = Range("A1")
MName = "A.xls!" & MName
Application.Run MName

Hope this helps


--
Gerd


"Kishore Shenoi" wrote:

I need to call a macro Macro1 written in A.xls from another macro Macro2
written in b.xls.

The file name "a.xls" is actually stored in column A on of b.xls, thus is in
a variable. Macro name Macro1 is defined and static.