![]() |
Running Excel macros through DOS
Is it possible to run Excel through the DOS shell? -- I want to open up a
text file in Excel, run a Macro that rearranges and parses text, then save it with a date-dependent name. |
Running Excel macros through DOS
c:\Excel.exe <cr
-- Regards, Tom Ogilvy "Ramesh Narasimhan" wrote in message ... Is it possible to run Excel through the DOS shell? -- I want to open up a text file in Excel, run a Macro that rearranges and parses text, then save it with a date-dependent name. |
Running Excel macros through DOS
Ramesh Narasimhan wrote...
Is it possible to run Excel through the DOS shell? -- I want to open up a text file in Excel, run a Macro that rearranges and parses text, then save it with a date-dependent name. If you're really processing text, Excel is a poor tool to use. There are many scripting languages that would be much easier to maintain and run in console sessions. Windows even comes with two scripting languages, VBScript and VJScript, which you could use to do this. That said, you could create a workbook containing the code necessary to process your text files in that workbook's Workbook_Open event handler. Then run Excel using CMD.EXE's start command with command line arguments for the text file to process and this workbook. Something like start excel d:\test\sample.txt d:\test\process.xls Note: the argument order is important. Put the pathname for the text file first followed by the pathname for the workbook. That way the text file will be open when the workbook loads and runs its Workbook_Open event. |
Running Excel macros through DOS
Tom Ogilvy wrote...
c:\Excel.exe <cr This is likely to produce the error message 'Excel.exe' is not recognized as an internal or external command, operable program or batch file. since the typical Office install doesn't put the Office program directory in either the system or installing user's PATH. OTOH, C:\ start excel does work even when the Office program directory isn't in PATH - it seems that start looks in the Registry to locate registered GUI programs. |
Running Excel macros through DOS
Guess I haven't started it from a command prompt lately. works OK in
windows 9x as I recall. C:\"C:\Program Files\Microsoft Office\OFFICE11\Excel.exe" did work in Windows XP. Obviously the correct path would need to be used. Thanks for the correction. -- Regards, Tom Ogilvy "Harlan Grove" wrote in message oups.com... Tom Ogilvy wrote... c:\Excel.exe <cr This is likely to produce the error message 'Excel.exe' is not recognized as an internal or external command, operable program or batch file. since the typical Office install doesn't put the Office program directory in either the system or installing user's PATH. OTOH, C:\ start excel does work even when the Office program directory isn't in PATH - it seems that start looks in the Registry to locate registered GUI programs. |
All times are GMT +1. The time now is 07:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com