Skip to main content

Command-line switches for Excel

When you launch a Microsoft Office product, the startup process runs in a standard way. If you want to customize the process even more by loading an add-in or running a macro upon startup. You can add options like this by using subcommands called command-line switches to an Office app's startup command.

  • If you want to use the customization just one time, you can type the command and switch in the Run dialog box (shortcut: Win+R) in Microsoft Windows.
  • If you want to use a particular switch many times or every time that you start the app, you can create a desktop shortcut that starts the program by using the same switch and parameters.

Startup command names and locations

Here are the names of the startup commands for the Office products Word, Excel, PowerPoint, PowerPoint viewer, Outlook, and Access.

Office product Command name
Word winword.exe
Excel excel.exe
PowerPoint powerpnt.exe
PowerPoint Viewer pptview.exe
Outlook outlook.exe
Access msaccess.exe

When you use one of the Office startup commands, you must supply the full path to the product's .exe file. Verify the location of this file on your computer. The following table shows the locations of the .exe files if you accepted the default folder locations during installation.

Office Location
In Office 2007 Windows 32-bit: C:\Program Files (x86)\Microsoft Office\Office12\

Windows 64-bit: C:\Program Files\Microsoft Office\Office12\

In Office 2010 Windows 32-bit: C:\Program Files (x86)\Microsoft Office\Office14\

Windows 64-bit: C:\Program Files\Microsoft Office\Office14\

In Office 2013 Windows 32-bit: C:\Program Files (x86)\Microsoft Office\Office15\

Windows 64-bit: C:\Program Files\Microsoft Office\Office15\

In Office 2016
& Office 2019
Windows 32-bit: C:\Program Files (x86)\Microsoft Office\Office16\

Windows 64-bit: C:\Program Files\Microsoft Office\Office16\

In Office 365 Windows 32-bit: C:\Program Files (x86)\Microsoft Office\root\Office16\

Windows 64-bit: C:\Program Files\Microsoft Office\root\Office16\

The command-line switches rules

  • You can use only one switch at a time. Starting an Office app with multiple switches is not supported.
  • If the parameter is a path to a location on your computer, or a file name with spaces in it, enclose it in double quotation marks, for example, /t "Monthly Report.dotx".
  • Switches and parameters are not case-sensitive. For example, /RO functions the same as /ro.
  • Include one blank space before each switch and one before each parameter.

Make a switch available for reuse by creating a shortcut

  1. Right-click the Windows desktop, point to New, and then click Shortcut on the shortcut menu.
  2. In the Create Shortcut Wizard, in the Type the location of the item box, type a double quotation mark ("), enter the full path for the app's .exe file (including the file name), and then type another double quotation mark. (Alternatively, click Browse to locate and select the file. In this case, the quotation marks are added automatically.)
  3. Following the closing quotation mark, type a space, and then type the switch and any parameters. If the parameter is a path to a location on your computer, and the path contains a space, it also must be enclosed in quotation marks. For example:
    "C:\Program Files\Microsoft Office\Office16\excel.exe" /r "D:\My Folder\book1.xlsx"

  4. Click Next.
  5. In the Type a name for this shortcut box, type a name for the shortcut, and then click Finish. The wizard creates the shortcut and places it on the desktop.

Whenever you want to use the shortcut to start the app, double-click it.

List of command-line switches for Excel

Switch and parameter Description
workbook path | file name

This parameter does not require a switch.

Starts Excel and opens the specified file.


excel.exe "c:\My Folder\book1.xlsx"


excel.exe http://MySite/Book1.xlsx

/r workbook path | file name Opens a specific workbook as read-only.


excel.exe /r "c:\My Folder\book1.xlsx"


excel.exe /r http://MySite/Book1.xlsx

/t workbook path | file name Starts Excel and opens the specified file as a template.


excel.exe /t "c:\My Folder\book_name.xlsx".


excel.exe /t http://MySite/book_name.xlsx

/n workbook path | file name Like /t, starts Excel and opens the specified file as a template.


excel.exe /n "c:\My Folder\book_name.xlsx".


excel.exe /n http://MySite/book_name.xlsx

/e or /embed Prevents the Excel startup screen from appearing and a new blank workbook from opening.


excel.exe /e

/p workbook path Specifies a folder as the active working folder (for example, the folder that is pointed to in the Save As dialog box).


excel.exe /p "c:\My Folder"

/s or /safemode Forces Excel to bypass all files that are stored in startup directories, such as the default XLStart folder located in the directory where Excel or Microsoft Office is installed.


excel.exe /s

/m Creates a new workbook that contains a single XLM macro sheet.


excel.exe /m

/a progID Starts Excel and loads the Automation add-in that is specified by the progID of the add-in.


excel.exe /a MyProgId.MyProgID2.1

/x Starts a new instance (a separate process) of Excel.


excel.exe /x "c:\My Folder\book1.xlsx"


excel.exe /x http://MySite/Book1.xlsx

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>