Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Call an Excel VBA Macro

Status
Not open for further replies.
Oct 22, 2001
215
US
Hi,
I am trying to call an Excel VBA macro from a VB program.

I got an excel file that got a macro (MyMacro). I can open the excel program fine using the following command:
--------------------------------------------
Workbooks.Open FileName:= _
"C:\MYTEST\Macro_Visio\TNT_DB.xls"
--------------------------------------------
But I don't know how to excute the Macro...
Can any one help plz. Thanks
 
OK,
Well since you don't seem to have a workbook variable set to the open book I guess this should work.

Workbooks.ActiveWorkbook.RunMacro "MyMacro"

In access I set a variable = to the workbook and use

MyVar.RunMacro "MyMacro"

Hope this helps

Kyle [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top