Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Cyberwolf
 
Posts: n/a
Default macros from command line

Is there a switch that will run a macro in my personal workbook from a
command line?
  #2   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Cyberwolf wrote:
Is there a switch that will run a macro in my personal workbook from a
command line?


------------------------

I don't quite understand what you mean by command line within the Excel context?

What you can do if you wish, is to create a button for it. Push the button and
the macro executes. You can place the button either on a sheet, or up in your
tool bar.

Bill
  #3   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Cyberwolf wrote:
Is there a switch that will run a macro in my personal workbook from a
command line?


------------------------

I don't quite understand what you mean by command line within the Excel context?
You know you can assign a key chord to invoke a macro? Ctrl-a, Ctrl-b, etc.

What you can do if you wish, is to create a button for it. Push the button and
the macro executes. You can place the button either on a sheet, or up in your
tool bar.

Bill
  #4   Report Post  
Jef Gorbach
 
Posts: n/a
Default


"Bill Martin -- (Remove NOSPAM from address)"
wrote in message ...
Cyberwolf wrote:
Is there a switch that will run a macro in my personal workbook from a
command line?


------------------------

I don't quite understand what you mean by command line within the Excel

context?
You know you can assign a key chord to invoke a macro? Ctrl-a, Ctrl-b,

etc.

What you can do if you wish, is to create a button for it. Push the

button and
the macro executes. You can place the button either on a sheet, or up in

your
tool bar.

Bill


The *simple* answer is no because Excel lacks Word's /m command line switch
.... however Michael Bednarek of the microsoft.public.excel.programming forum
helped develope the following WSH/VBS work-around.
Save excel.vbs somewhere along your command Path
(ie:c:\windows\command\e.vbs) then either setup shortcut icons to indivual
macros or invoke it directly via the Windows Run box.
ie: [Windows]+R excel.vbs macroname [enter]

' Filename: excel.vbs
' Overcomes Excel inability to run macros from the command line
' Usage: excel.vbs modulename.macroname
' modulename not required if macroname in default Module1
' requires WSH to be installed
'
'open excel
Dim macro
Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.add
xlapp.workbooks.open "C:\Program Files\Microsoft
Office\Office\Xlstart\personal.xls"
'
'now run macro
If wscript.arguments.count = 0 Then
'do nothing
Else
macro = "Personal.xls!" & WScript.Arguments.item(0)
xlapp.run macro
End If



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
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 11:57 PM
sorting with macros Sorting in macros Excel Discussion (Misc queries) 1 February 1st 05 10:02 AM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 01:21 AM
The available macros list in XL; how to suppress filename from showing KR Excel Discussion (Misc queries) 1 January 10th 05 08:20 PM
Macros disappear after a file is imported Brent E Excel Discussion (Misc queries) 1 December 18th 04 01:25 AM


All times are GMT +1. The time now is 04:13 AM.

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"