![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Philadelphia, PA
Posts: 125
|
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 |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Decatur IL, USA
Posts: 494
|
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
__________________
Thanks, Shirlene |
|
|
|
|
|
#3 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
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 _________________ Cheers, NateO ![]() [ This Message was edited by: NateO on 2002-05-10 09:20 ] |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|