FYI: We're upgrading our website look and feel over the next 30 days. This page will be done soon!
Run Excel Macros from the command line easily with 'Convert XLS'.


Customers
 

Run Excel Macros from the command line  software, adobe customer

Adobe Systems Inc. Chooses 'Convert Doc'.  A custom site license has been signed by Adobe allowing them to install 'Convert Doc' on their servers.  They will be using it specifically to do Doc to HTML conversions. "We look forward to using your product and potentially working together in the future", Bob Free, Adobe

Run Excel Macros from the command line IBM Customer

Great customer service, prompt attention to our requirements and lightening speed development has been my experience with the staff at Softinterface Inc. Within a few hours of installing... Bruce King, IBM Canada, Toronto, Ontario


Click for the BBB Business Review of this Computers Hardware, Software & Services in Santa Monica CA


You need to convert from

CSV to XLS

CSV to XLSX

CSV to Fixed Width Text (ASCII/ANSI/Unicode)

XLS to CSV (Unicode/ASCII/ANSI)

XLS  to Fixed Width Text (Unicode/ASCII/ANSI)

XLSX to CSV (Unicode/ASCII/ANSI)

XLSX  to Fixed Width Text (Unicode/ASCII/ANSI)

Fixed Width Text File to XLS

Fixed Width Text File to XLSX

Fixed Width Text File to CSV

More...

 

Run Excel Macros From Command Line Or In an Automated Way

('Convert XLS' the Excel Manipulation Utility)

English, Deutsch, Franšais, Italiano, 日本語, Brazilian Portuguese, Espa˝ol, Other Languages

'Convert XLS' logo, can be used to run Excel Macros from the command line

Need to run Excel macros from the command line or in some automated way?  We've got your tool.  Softinterface has created a sophisticated software utility called 'Convert XLS' which has many 'special processes' to convert/manipulate Excel files (including the running of Excel macros). Read below for details on this specific feature, or click on the 'Convert XLS' home page to get a better idea of what the product does completely.

See the bottom of this page for some examples of how to automate the execution of an Excel macro. We have a built in scheduler as well as a command line (and a COM/ActiveX) interface which will allow you to leverage 'Convert XLS' to automate your workplace!

Download Run Excel Macro utility

Office 2013 Compatible!

'Convert XLS' Running a Macro

Writing Excel macros is beyond the scope of this brief discussion; please check your Excel documentation for assistance.

Advanced users of Excel make creative macros that are capable of simple to highly sophisticated operations. If you find something is lacking within 'Convert XLS' you can very likely use this special process to extend and enhance its capabilities.

Follow these steps to run a macro of a workbook:

1. Select the special process "[114] (*.XLS) Run a Macro" from the Special Process drop down list.

2. Next select original and target files. Target file is only needed if you have chosen to "Save Workbook After Macro Execution".

Click the ‘Click Here for Run Macro Details’ button to modify this special processes behavior. Note that you can optionally save the workbook after running the specified macro. Also, you can choose up to 8 parameters/arguments to pass to the macro. Please leave all arguments completely empty (blank) if they are not used, else an error will occur when attempting to run.

The syntax for specifying a macro is:

ObjectName.MacroName

If the macro is located in a separate workbook use this syntax:

‘FullPath’!ObjectName.MacroName

ObjectName can be any defined object with a workbook VBA area such as Sheet1, Sheet2, Module1, ThisWorkbook etc. If specifying a FullPath be certain to add the single quotes. For example this would be a valid entry:

'c:\path\WorkbookWithMacros.xls'!module1.MacroName

Run an Excel Macro from the command line dialog box

3. Click the Add button to add the task to the Conversion Task list. You may add multiple tasks to the Conversion Task list before initiating the conversion process by repeating Steps 1 - 3 as necessary.

Click the ‘Convert’ button to execute the process.

 

'Convert XLS' Command Line

NOTE: 'Convert XLS' can be used simply with the graphical user interface (GUI).  If you've never heard of 'Command Line' before, we would recommend not reading this section and instead download and try the software.

This is just a sample from the documentation.   If you have trouble running these examples please see Helpful Hints For Creating a Command Line within the documentation.

Command Line Explained

'Convert XLS' can be run without a user interface with command line arguments much like in the good old DOS days.  Alternatively you can initiate command line execution by going to the operating system 'command prompt' or within Windows at the START-RUN menu and typing it in there.  Lastly, the command line interface can be used from Batch files (files with *.BAT extension). 

There are two approaches to using the command line:

     A)  Specify a 'Conversion Job' that was built using the graphical user interface (GUI); or

     B)   Specify a 'Conversion Task' in detail from the command line.

See the  'Convert Xls' documentation for a full explanation and reference.  Below we focus specifically on using 'Convert XLS' to execute an Excel Macro from the command line.

Run/Execute an Excel Macro From the Command Line

The special process associated with printing is 113. 

/P#

Meaning

Extra Parameters: /1{Parameter1} … /n{Nth Parameter}

114

Run/Execute an Excel Macro

/1 = sMacroName

/2 = bSaveAfterRunning ("TRUE" or "FALSE"). Set to "TRUE" to save the workbook after running the macro. You must specify the /T command line argument if you set this to true.

/3 = sArg1 Use the next 8 parameters (/3-/10) if and only if your macro requires arguments.

/4 = sArg2
/5 = sArg3
/6 = sArg4
/7 = sArg5
/8 = sArg6
/9 = sArg7
/10 = sArg8

This special process can run a macro that you specify and optionally save the workbook after execution.

Writing Excel macros is beyond the scope of this manual; please check your Excel documentation for assistance.

Special Parameters Described in Detail

/1{sMacroName} The syntax for specifying a macro is:

ObjectName.MacroName

ObjectName can be any defined object with a workbook VBA area such as Sheet1, Sheet2, Module1, ThisWorkbook etc.

/2 {bSaveAfterRunning} To save the workbook after execution of the macro, set this parameter to "TRUE", else "FALSE".

/3 … /8 {sArg1…Arg8} If your macro has arguments/parameters that need to be passed to it, use sArg1-sArg8 to facilitate this.

Examples:

EXAMPLE 1: Executing an Excel Macro from the Command Line

  1A) To run MySimpleMacro() that requires no arguments, within the worksheet "Sheet1" of "C:\MyFiles\Summary.XLS", and not save after running, the following syntax would be used:

ConvertXLS.EXE /S"C:\MyFiles\Summary.XLS" /P114 /1"Sheet1.MySimpleMacro" /2 FALSE

  1B) To run MyAdvancedMacro(), which requires 3 arguments, within the worksheet "Sheet2" of "C:\ExcelFiles\Sum.XLS", and save after running, the following syntax would be used:

ConvertXLS.EXE /S"C:\MyFiles\Sum.XLS" /T"C:\MyFiles\Sum.XLS" /P114 /1"Sheet2.MyAdvancedMacro" /2 TRUE /3 "Apples" /4 "Oranges"  /5 "Pears"

  1C)  If your macro is located within a different workbook use this syntax:

ConvertXLS.EXE /S"C:\MyFiles\Sum.XLS" /T"C:\MyFiles\Sum.XLS" /P114 /1"'c:\fullpath\ExcelFileWithMacros.xls'!module1.MacroName" /2 TRUE /3 "Apples" /4 "Oranges"  /5 "Pears"

Notice the single quotes around the full path of the Excel file with the Macros.  These single quotation marks are critical.

See Also:

 

Special Promotion: Buy 'Convert XLS' and get 'Convert Doc', 'Convert Image' and 'Convert PowerPoint' free!