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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run an excel macro in VB.NET 1

Status
Not open for further replies.

jonx

Programmer
Sep 2, 2003
34
0
0
US
Hello, I have an excel macro defined within an excel workbook, in other words if I push alt+F8 in Excel with that workbook, the macro will automatically run. Is there a way I could run this macro from VB .NET?

Thanks
 
Jon,

You can use following code to run the macro from .NET

Code:
'Run the macro
excelBook.Application.Run("Main")

Here Main is the macro name that Excel workbook has.

-Kris
 
Also when I was trying to implement the same I had spent sometime researching various options available to achieve this. If you scroll all the way down to the following thread thread796-319126, you can see the details of how I achieved this.

-Kris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top