Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The need: run a macro within an excel 2003 file every week, automatically, than save the file.

The approach: add an action to task manager for every week, calling the file with command line parameters.

The problem: what parameters are need to be called and how to start a macro from command line? Is it even possible?

share|improve this question
up vote 2 down vote accepted

You could do this with VBScript. Here's some example code:

Option Explicit
Dim excelObject

Set excelObject = CreateObject("Excel.Application")
excelObject.WorkBooks.Open "path:\to\file.xls", 0, True
excelObject.Run "MacroName"
excelObject.Quit

Set excelObject = Nothing

Paste that into a file with extension .vbs and running that script should open the desired spreadsheet in Excel, running the macro with name 'MacroName'.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .