LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Execute a macro from command line: possible or not ?

I wonder if this would be OK for me too?

I have a spreadsheet with a couple of command buttons, neither of which I
want to run automatically. BUT I DO want, at a scheduled time, to open Excel
and run one of the buttons (at different times and under different
circumstances.)
- One button is a raw data import from six other spreadsheet, which I want
to run early in the morning so the sheet is ready when people get to work.
The other is an export, which I want to run when everybody has finished for
the day . I tried doing all the work in Access, but the machine runs out of
resources because it has to keep Access AND Excel open.


It looks as though the code sent by papou should do the job, just by putting
in the right vba sub name.

Is there an editor like vba that will give me autocorrection/debug
capability, or am I limited to something like notepad, and running the whole
thing and hoping?
The actual code takes about 30 minutes to run.

It does seem odd that Microsoft has given us command line switches in the
other Office Applications, but not Excel, where it would be more useful than
it is in Word. Judgiing by various threads I've just read, there is a big
demand for this functionality. Probably more than there is for hidden flying
games.




"papou" wrote:

Hello Drinkmilk
This is possible using a script.
Paste this into a new text file and amend accordingly.
Save with .VBS suffix and double-click to run.

Dim objxl, xlwbk
Set objxl = CreateObject("Excel.Application")
objxl.Visible = True
Set xlwbk = objxl.Workbooks.Open("C:\Documents and Settings\papou\My
documents\Sample1.xls")
objxl.Run ("Go")

HTH
Cordially
Pascal


"Drinkmilk" a écrit dans le message de
news: ...
Hello,

I would like to know wether it is possible to run a macro in command line
mode for Excel. After having searched in the Web and on this forum, I have
seen several comments saying that it is impossible. I am very surprised
because this is possible with Word, using for example:
"C:\Program Files\Microsoft Office\OFFICE11\WinWord.exe" "c:\MyDoc.doc"
/mFileOpenAndRepair

Can you confirm if really this is not possible with Excel ?

Many thanks





 
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
Macro won't execute from a Command Button Dick Scheibe[_2_] Excel Programming 8 August 21st 05 12:16 AM
Running a macro from the command line Czech Excel Programming 1 October 28th 04 09:51 PM
Creating command buttons beside every row to execute each row macro sirriff Excel Programming 3 September 12th 04 03:42 AM
Execute a command line app but i want a string returned. dei Excel Programming 0 October 23rd 03 08:18 AM


All times are GMT +1. The time now is 02:32 PM.

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

About Us

"It's about Microsoft Excel"