1

I wanted to know that if I do

start excel temp.xls

The os will start a new excel instance and open the workbook temp.xls in that instance, AS AN ATOMIC action.

Right now what I have is

start excel
start temp.xls

And most often these two command will mess up my other excel instance, ie, opening temp.xls in another excel instance that has another workbook already opened.

Thanks,

Johnyy
  • 2,056
  • 3
  • 22
  • 28
  • @Cody Gray: I tried it several times. Seems fine. But my environment is different from the real one, which has many heavy duty spreadsheet running. – Johnyy Apr 27 '11 at 11:37
  • To guarantee a new instance, you could use VBA and CreateObject to start Excel. The COM object has a method to open files as well. – Vik David Apr 27 '11 at 14:38

2 Answers2

2

While I think that "start excel temp.xls" will open temp.xls in the Excel instance started by start, you'd be on the safe side, if you use

  "<PathToExcel>excel" [/<opt>] "<PathToXls>temp.xls"

For opt see cli for excel (pick the docs for your version).

Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96
1

The Command-line switches for Excel 2007 document explains the switches:

You can change certain aspects of how the program starts by adding subcommands called switches to the Excel.exe command. A switch appears as a space after the main command, followed by a slash mark (/) and the name of the switch. The switch is sometimes followed by another space and then one or more specific instructions called parameters, which give the program further information about how to execute the Excel.exe command.

In your case you do not use a switch but a parameter. It is used to give the program further information about how to execute the Excel.exe command.

Parameter: file name
Description: starts Excel and opens the specified file.

So I would assume that the parameter is bound to the excel instance started.

FrVaBe
  • 47,963
  • 16
  • 124
  • 157