Opening Workbook with Command Line Switches in Existing Instance

angusrouse

New Member
Joined
Feb 17, 2014
Messages
4
Hello all,

I've had a look through the existing topics on this issue but they all seem to be trying to achieve the opposite result of what I'm after.

I have a number of index workbooks that my colleagues and I will reference throughout the day. Whilst we can (and will) add data to these workbooks as needed, the majority of the time they are in use is purely for looking up data. To avoid issues of the documents being in use when someone does want to add data, I would prefer that all my colleagues open them as read only by default and for this I have created a number of windows shortcuts located in a common directory that should open each file in read only mode. The problem I face is that while running these shortcuts will open the workbooks as read only, it also forces them to run in a new instance of Excel but I would like them to run in the same existing instance (if already running).

Here is an example of one of the shortcut targets:

Code:
"C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE" -r "S:\Design\Index Documents\CIM_Favourites.xlsm"

I'm aware there is a switch for opening in a new instance (-x) but as you can see I'm not using this and still having the same effect. Even removing the -r switch will open the file in a new window/instance.

Any other method of opening documents will open within an existing instance and whilst we could open the workbooks using File > Open > Browse > Open as Read-Only, but it's very long winded and the shortcuts would be far more convenient.

Anyone have any thoughts? Am I missing something obvious?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,
I can't find any such switch available to tell Excel to try to find a running instance so it doesn't seem possible to create a shortcut like you describe. I suppose you could try creating little VBScript files to use as your shortcuts but that's a little messy/awkward/ugly.

The only other option I can think of is that you can save the file with "Read-Only" as the *recommended* way to open the file. Then when the user opens the file they would be prompted with a message that tells them that this file is recommended to be opened read only. They would have to specifically choose to open it with write permissions.
See: Excel 2010/2007: Force “Open as Read Only” Prompt
 
Upvote 0
The only other option I can think of is that you can save the file with "Read-Only" as the *recommended* way to open the file. Then when the user opens the file they would be prompted with a message that tells them that this file is recommended to be opened read only. They would have to specifically choose to open it with write permissions.
See: Excel 2010/2007: Force “Open as Read Only” Prompt

So simple yet exactly what I needed. I was having to make two separate shortcuts before - one for read only and one for write-access but now we just choose the option upon opening.

Thanks.
 
Upvote 0

Forum statistics

Threads
1,215,509
Messages
6,125,216
Members
449,215
Latest member
texmansru47

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top