none
How to call a VBA method from the command line RRS feed

  • Question

  • I have an application that was written in Access.  I now have need to call some of the logic in the application from a batch file.  How can I call a VBA method from the command line?

    I have been trying to get this to work using a VBS script and the cscript command, but I don't know how to reference the application name ("Our_Application.application").  Am I on the right path?

    Tuesday, September 29, 2015 7:37 PM

All replies

  • Run a macro from a .bat archive

    cd\
    
    c:
    
    cd Program Files
    
    cd Microsoft Office
    
    cd Office15
    
    Msaccess.exe "c:\database.accdb" /x "MACRO NAME"
    Msaccess.exe "c:\database.accdb" /Compact
    
    pause

    An example from gallery:

    https://code.msdn.microsoft.com/office/How-to-schedule-VBA-Macros-f09ceca9

    • Proposed as answer by André Santo Tuesday, September 29, 2015 8:51 PM
    Tuesday, September 29, 2015 8:51 PM
  • Thanks for the response!

    I found my MSACCESS.exe under C:\Program Files (x86)\Microsoft Office\Office14\


    • Edited by Ricky Silva Tuesday, September 29, 2015 9:25 PM
    Tuesday, September 29, 2015 9:07 PM