felix0322
felix0322

Reputation: 305

Start VBA macro (Excel) from commandline

I have a VBA macro in Excel, which generates some C-code. Is is it possible to trigger the execution of this macro as part of the make-based build process (e.g. via VBScript)? If yes, how?

Upvotes: 2

Views: 1030

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 55059

Yes, you need to automate Excel and then you use the InvokeMember function to run your macro.

The following article shows you how to do it from .Net, it should be similar to call from VBscript except that you'll need to use late binding: HOW TO: Run Office Macros by Using Automation from Visual C# .NET

And here's a blog post showing how to call a custom macro in Outlook from VBScript: Calling Outlook VBA Macro from outside (VB/VBScript/C#)

Upvotes: 1

Related Questions