Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are there command line parameters for Excel? Michael Excel Discussion (Misc queries) 9 August 5th 07 06:29 PM
Run Macro from Command line Phil Smith Excel Discussion (Misc queries) 1 July 21st 07 06:35 PM
What are the possible command-line arguments in Excel? d2reason Excel Discussion (Misc queries) 2 June 4th 07 09:39 PM
command line Excel Script [email protected] Excel Discussion (Misc queries) 0 August 22nd 06 01:23 PM
Load DBF file into Excel on command line? prospects Excel Discussion (Misc queries) 0 January 30th 05 01:39 AM


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"