Opening an Excel Spreadsheet

  • Thread starter Thread starter Mr. Novice
  • Start date Start date
M

Mr. Novice

Hello,

When I try to open and excel spreadsheet that somebody
else has open from a command prompt I get this error: "The
process cannot access the file because it is being used by
another process."

The syntax I'm using is...

start "C:\Program Files\Microsoft
Office\Office\EXCEL.exe" "\\server\share\spreadsheet.xls"

I've also tried just "\\server\share\spreadsheet.xls".


The desired result is to have the spreadsheet open and let
Excel tell you that somebody else is using it and give you
the read-only and modify options.

Does anybody know how to do this?

Thanks!

Chad
 
Mr. Novice said:
Hello,

When I try to open and excel spreadsheet that somebody
else has open from a command prompt I get this error: "The
process cannot access the file because it is being used by
another process."

The syntax I'm using is...

start "C:\Program Files\Microsoft
Office\Office\EXCEL.exe" "\\server\share\spreadsheet.xls"

I've also tried just "\\server\share\spreadsheet.xls".


The desired result is to have the spreadsheet open and let
Excel tell you that somebody else is using it and give you
the read-only and modify options.

Does anybody know how to do this?

This will open an instance of Excel with the file in READ-ONLY mode if it's
already open.

OpenWorkSheet.vbs "%USERPROFILE%\My Documents\Snowfall.xls"

'OpenWorkSheet.vbs
args = WScript.Arguments.Count
if args <> 1 then
Wscript.Echo "usage: " & Wscript.ScriptName & " filename"
wscript.Quit
end if

excelFile = WScript.Arguments.Item(0)
set oXL = createobject("Excel.Application")
oXL.workbooks.open(excelFile)
oXL.visible = true
 
Mr. Novice said:
The syntax I'm using is...

start "C:\Program Files\Microsoft
Office\Office\EXCEL.exe" "\\server\share\spreadsheet.xls"
Does anybody know how to do this?

Beside Pauls tip,
be aware that start syntax in on topic os states that the first quoted
element being the windows title.
Excel.exe _should_ be in the apppath, so no need to include it.

This probaply works. not tested.
start "" excel.exe "\\server\share\spreadsheet.xls"

HTH
 
Matthias Tacke said:
Excel.exe _should_ be in the apppath, so no need to include it.

What you mean is starting based on file type. This will work:
"%USERPROFILE%\My Documents\Snowfall.xls"
to start Excel but that will also produce the 'in use' error message.
 
Paul R. Sadowski said:
What you mean is starting based on file type.

Paul, I'm shure I meant this registry entry "App Paths" ;-)

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe"

This allows you to execute excel.exe without specifying the path and
without the location of excel.exe being in the env var path.
This will work:
"%USERPROFILE%\My Documents\Snowfall.xls"
to start Excel but that will also produce the 'in use' error message.

Here this works:

start "" excel.exe "\\server\share\spreadsheet.xls"

HTH
 
Matthias Tacke said:
Paul, I'm shure I meant this registry entry "App Paths" ;-)

reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\excel.exe"

This allows you to execute excel.exe without specifying the path and
without the location of excel.exe being in the env var path.

OK, cool! I get it now. It works with the START command only. You can tell I
don't use START much (at all!). :)

Thanks...
 
Paul R. Sadowski said:
OK, cool! I get it now. It works with the START command only. You can tell I
don't use START much (at all!). :)
Maybe, but thats the same mechanism allowing you to create some app
shortcuts without the whole path and also to start/execute them.
 
Matthias Tacke said:
Maybe, but thats the same mechanism allowing you to create some app
shortcuts without the whole path and also to start/execute them.

What I meant is that you can't just type excel at the cmd-prompt to start
Excel, y ou have to use START.
 
This works great! Thanks!!

Chad

Matthias Tacke said:
Beside Pauls tip,
be aware that start syntax in on topic os states that the first quoted
element being the windows title.
Excel.exe _should_ be in the apppath, so no need to include it.

This probaply works. not tested.
start "" excel.exe "\\server\share\spreadsheet.xls"

HTH
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
Back
Top