Link to home
Start Free TrialLog in
Avatar of jogmen
jogmen

asked on

Exec Excel Macro from VB6

Is there a way to kick off a
macro resident in a Excel 2000 spreadsheet (other than the auto ones) from a visual basic .exe?

Thanks a bunch.
Avatar of wesleystewart
wesleystewart

I'm a little fuzzy on this (it has been a while . . .) but I think it goes like this.  Declare and instantiate a reference to an Excel object, then invoke the procedure with the .Run method:

Dim objExcel as object
Set objExcel = GetObject(, "Excel.Application")
objExcel.Run("sub as string", arg1, arg2)

You need to reference the Excel library.

Wes

ASKER CERTIFIED SOLUTION
Avatar of MTroutwine
MTroutwine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One thing as mentioned by wesleystewart, you will need to add a reference to the following:

Microsoft Excel 9.0 Object Library