Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro on a DOS command line
Is there a way to run an Excel macro on a DOS command
line? Something that just run a macro and then exits Excel. I looked in Help, but don't see any command line switch that does this. Any suggestion is appreciated. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro on a DOS command line
Hi Richard,
No. You can open the workbook, and if it contains a macro "Auto_Execute()" it will run. excel.exe path\filename.xls -- John johnf202 at hotmail dot com "Richard" wrote in message ... Is there a way to run an Excel macro on a DOS command line? Something that just run a macro and then exits Excel. I looked in Help, but don't see any command line switch that does this. Any suggestion is appreciated. Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro on a DOS command line
I'm pretty sure he'll want the (now obsolete) sub Auto_Open(), or the more
current WorkBook_Open event. I don't think Auto_Execute is supported. Randall Arnold "jaf" wrote in message ... Hi Richard, No. You can open the workbook, and if it contains a macro "Auto_Execute()" it will run. excel.exe path\filename.xls -- John johnf202 at hotmail dot com "Richard" wrote in message ... Is there a way to run an Excel macro on a DOS command line? Something that just run a macro and then exits Excel. I looked in Help, but don't see any command line switch that does this. Any suggestion is appreciated. Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro on a DOS command line
Maybe you could just use this from the DOS prompt or within a .bat file:
Start "c:\my documents\excel\book1.xls" Name your macro (in a general module) Auto_open. Then when windows starts excel with your workbook, your auto_open kicks in and runs your code. Make sure you have macros enabled (so you don't have to worry about the macros prompt). And maybe something like: application.quit right at the end of your code. When you're testing, leave this line out--or hold the shift key when opening that workbook--so your workbook stays open. Richard wrote: To run VBScript, I would need to subscribe to MSDN, yes? -----Original Message----- Another alternative would be to drive Excel from VBScript. You could create some VBScript which does whatever you want (open files, manipulate them, save etc) which can be executed from a command prompt. This is more of a suggestion for what may be another way of doing what you're trying to acheive. As the other poster's said there are only a couple of events which are fired when a workbook opens and unless they are in place nothing will happen when the workbook loads. If you're interested in a short primer on VBScript look at http://www.billlunney.com/Excel/FAQ/DisplayFAQ.ascx? ExcelFAQID=129 -- Regards, Bill Lunney www.billlunney.com "Richard" wrote in message ... Is there a way to run an Excel macro on a DOS command line? Something that just run a macro and then exits Excel. I looked in Help, but don't see any command line switch that does this. Any suggestion is appreciated. Thanks in advance. . -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Are there command line parameters for Excel? | Excel Discussion (Misc queries) | |||
Run Macro from Command line | Excel Discussion (Misc queries) | |||
What are the possible command-line arguments in Excel? | Excel Discussion (Misc queries) | |||
command line Excel Script | Excel Discussion (Misc queries) | |||
Load DBF file into Excel on command line? | Excel Discussion (Misc queries) |