Calling Excel Macro (Sub) from Visual Basic 6.0

Posted on 2003-03-06
Medium Priority
Last Modified: 2013-11-25
Please advise how to call a macro (sub) in Excel (Office XP) from a Visual Basic 6.0 Script.  Thx! - Adam
Question by:iamadamc
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Diveblue earned 200 total points
ID: 8083961
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"


Expert Comment

ID: 8084037
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"

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question