View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Excel command line

#4. Open a workbook that runs the macro in personal.xls
#5. Use a VBS script to start excel and run your macro.

Something like:

Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.add
xlapp.workbooks.open "c:\yourpathto\personal.xls"
xlapp.run "Personal.xls!macronamehere"

Save this text file as something.vbs.

Then put a shortcut on your desktop to run this (or run it directly from the
windows start button|run box)

(Do you need to have a specific workbook open when the userform starts?





Jef Gorbach wrote:

Normally start Excel via the Window's-Run command box.

Approx 1/day, use a simple form-creation macro from Personal.xls via a
custom button which I would like to call from the command line like Word
does. (IE: windows-R excel /mMACROenter)

However Help/Google imply Excel's equivalents to Word's /mMACRONAME switch
are auto_open or workbook _open, neither of which apply in this instance
since the macro is part of Personal.xls and shouldn't run everytime Excel
opens. (BTW, using Office97)

Are the solutions really:
1. leaving well enough alone
2. saving the results to a file and cluttering the desktop with yet
another icon
3. recoding in Word
???


--

Dave Peterson