Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.