+ Reply to Thread
Results 1 to 2 of 2

Call a Macro from Command Line

  1. #1
    Registered User
    Join Date
    04-24-2009
    Location
    Ireland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Call a Macro from Command Line

    Hi

    I have a macro in a workbook that I want to kick off from a batch file

    I can use the on workbook open command, but that would mean that i would have to call the macro every time I open the file myself too, which I don't want to do as I would have to modifiy the file occasionally

    Is there a way to call a specific macro from a file in command line?

    Something like C:\test\text.xls {test_macro}

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Call a Macro from Command Line

    You could do it with a VBScript (.vbs) file which you call from your batch file. This example allows the workbook to be specified as a command line argument for a bit more flexibility.

    Save this as Run_Excel_Macro.vbs:
    Please Login or Register  to view this content.
    Call it from the command line or your batch file like this:

    Run_Excel_Macro.vbs "C:\Full\Path\To\Your_Excel_Workbook.xls"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1