Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Run Excel Macro from Command Line

Is there a way to run an Excel macro from a command line. Such as when you
open up a file to have it run the macro. Since I want to do this for files
that are newly created I can not program the file to run the macro at
startup. Is there a command line option in excel?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Run Excel Macro from Command Line

Can you use automation to run the macro? You can create a script file
to do this and run it from the command line....

Others may have more suggestions if you can outline what it is you're
doing.

Tim.


"Al Franz" wrote in message
...
Is there a way to run an Excel macro from a command line. Such as
when you open up a file to have it run the macro. Since I want to
do this for files that are newly created I can not program the file
to run the macro at startup. Is there a command line option in
excel?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Run Excel Macro from Command Line

On Sun, 12 Jun 2005 21:25:08 -0700, "Al Franz"
wrote in
microsoft.public.excel.programming:

Is there a way to run an Excel macro from a command line. Such as when you
open up a file to have it run the macro. Since I want to do this for files
that are newly created I can not program the file to run the macro at
startup. Is there a command line option in excel?


Not to my knowledge. You have to write some VBS code for that. E.g.:

Option Explicit
Dim objXL

Set objXL = WScript.CreateObject("Excel.Application")
objXL.WorkBooks.Open "d:\dir\fubar.xls"
objXL.Visible = TRUE ' Optional
objXL.Run("yourMacro")
objXL.Quit
Set objXL = Nothing

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Excel Macro from Command Line

There is no command line option in excel that will allow you to do this but
you shouldn't need to. How are you creating the new workbooks? I assume
you will do it programmatically from another workbook that you're working
from? If so then you can do whatever you need to do to this newly created
file from that workbook; even have it write the module to your new file.
Would probably need some more information on what you are trying to do so if
you can explain in more detail then I may have some example code to help you.

"Al Franz" wrote:

Is there a way to run an Excel macro from a command line. Such as when you
open up a file to have it run the macro. Since I want to do this for files
that are newly created I can not program the file to run the macro at
startup. Is there a command line option in excel?




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
Run Macro from Command line Phil Smith Excel Discussion (Misc queries) 1 July 21st 07 06:35 PM
Running a macro from a command line Kelly Excel Programming 4 November 30th 04 08:17 PM
Running a macro from the command line Czech Excel Programming 1 October 28th 04 09:51 PM
call excel 2003 macro from command line Keven[_2_] Excel Programming 1 June 2nd 04 05:33 AM
Excel macro on a DOS command line Richard[_13_] Excel Programming 3 July 18th 03 03:35 AM


All times are GMT +1. The time now is 08:48 AM.

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"