Macro Help

mijofr

Board Regular
Joined
Jan 16, 2007
Messages
59
How do I instruct a macro to open other spreadsheets in a "read only" format?

I have a macro in spreadsheet "A" that opens a variety of other spreadsheets, does calculations in those other spreadsheets, then summarizes the resultant data back in spreadsheet "A". The problem is that it is opening those other spreadsheets as read-write then overwriting the existing data when it closes them. I do not want this to happen and I can't always be sure that someone else won't be working in those other spreadsheets when I run my macro. I want my macro to open those other spreadsheets in "read only" mode, then close without saving changes.

How do I do that?

Thanks
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi there,

Try:

Code:
    Workbooks.Open Filename:="C:\myfile\Book1.xls", ReadOnly:=True
    Windows("Book1.xls").Close SaveChanges:=False
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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