Forcing read-only

EconSean

Board Regular
Joined
Apr 21, 2002
Messages
129
I was wondering if someone could instruct me on how to force Excel to open a file as read-only.

I tried this in the Auto_Open sub, but the user is still prompted (I don't want them to be able to click "No" when asked if they should open as read only, I want the "Yes" forced on them.):

Application.DisplayAlerts = False

I hope this makes sense. Thanks in advance for any hints.

Regards,

Sean
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
The only way I know to set it as read-only so that you are NOT prompted to say Yes or NO, is to go into the Windows Explorer, locate the file, right-click and go to Properties and change the file properties to READ-ONLY.

I hope this helps
 
Upvote 0
Depends on what you're doing. If it's for your sake, you need to open the file with a VBA procedure (from a different workbook) with your alerts turned to false.

If it's to make decisions for others, you'll need to save the file with Windows variety of read-only (like wilkisa mentioned) with code like:

Code:
SetAttr activeworkbook.fullname, vbReadOnly
Hope this helps.



_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
wave.gif

This message was edited by NateO on 2002-05-10 09:20
 
Upvote 0
Or you could try:-

Private Sub Workbook_Open()
ThisWorkbook.ChangeFileAccess xlReadOnly
End Sub

Obviously you could allow certain people read/write access by use of some IF statements and by checking some criteria e.g. the Windows username.

HTH,
Dan
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,543
Latest member
MartinLarkin

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