Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Calling Excel Macro (Sub) from Visual Basic 6.0

Please advise how to call a macro (sub) in Excel (Office XP) from a Visual Basic 6.0 Script.  Thx! - Adam
0
iamadamc
Asked:
iamadamc
1 Solution
 
DiveblueCommented:
You need to use the excel run method...something like

Dim xl as new Excel.Application

XL.Workbooks.Open("C:\macroworkbook.xls", 0, True, , , , True)

XL.Run "MacroName"



0
 
Mango2Commented:
Set ApExcel = CreateObject("Excel.application")
'Creates an object
    ApExcel.Visible = True ' So you can see Excel
    ApExcel.Workbooks.Open FileName:=gstrMacroPath
    ApExcel.Application.Run "auto_open"
    ApExcel.Application.Quit
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now