Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good day. I have an Excel file that I want to give the users an option of
opening Read Only or open for edit. I don't want to do this through a desktop shortcut, but rather through VBA. Is there any VBA code that will allow this, or can I make a file read only once it is opened using "ReadOnly:=True" or something of that nature. Thanks, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you could do this:
Save your file with "readonly recommended" checked. File|SaveAs|tools|general options|check that "read-only recommended" box. Then the user will be prompted each time they open it. ==== If you really want VBA (I wouldn't!) since macros can be disabled. You could ask after the workbook is opened. Option Explicit Sub auto_open() Dim resp As Long If ThisWorkbook.ReadOnly = True Then 'they opened it readonly 'do nothing Else resp = MsgBox(Prompt:="What to change it to readonly?", _ Buttons:=vbYesNo) If resp = vbYes Then ThisWorkbook.ChangeFileAccess xlReadOnly End If End If End Sub Steve wrote: Good day. I have an Excel file that I want to give the users an option of opening Read Only or open for edit. I don't want to do this through a desktop shortcut, but rather through VBA. Is there any VBA code that will allow this, or can I make a file read only once it is opened using "ReadOnly:=True" or something of that nature. Thanks, -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Dave, just what I needed.
"Dave Peterson" wrote: Maybe you could do this: Save your file with "readonly recommended" checked. File|SaveAs|tools|general options|check that "read-only recommended" box. Then the user will be prompted each time they open it. ==== If you really want VBA (I wouldn't!) since macros can be disabled. You could ask after the workbook is opened. Option Explicit Sub auto_open() Dim resp As Long If ThisWorkbook.ReadOnly = True Then 'they opened it readonly 'do nothing Else resp = MsgBox(Prompt:="What to change it to readonly?", _ Buttons:=vbYesNo) If resp = vbYes Then ThisWorkbook.ChangeFileAccess xlReadOnly End If End If End Sub Steve wrote: Good day. I have an Excel file that I want to give the users an option of opening Read Only or open for edit. I don't want to do this through a desktop shortcut, but rather through VBA. Is there any VBA code that will allow this, or can I make a file read only once it is opened using "ReadOnly:=True" or something of that nature. Thanks, -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Read only file is NOT Read only | Excel Discussion (Misc queries) | |||
I have a read only xl file, I need it to be read and write | Excel Discussion (Misc queries) | |||
Read-write/Read-only | Excel Discussion (Misc queries) | |||
XCEL FILE REC'D AS READ ONLY -- HOW TO NOT BE "READ ONLY" | Excel Discussion (Misc queries) | |||
How can a file be converted from Read-Only to Read/Write | Excel Discussion (Misc queries) |