ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto open workbook to make read-only (https://www.excelbanter.com/excel-programming/428201-auto-open-workbook-make-read-only.html)

Tim C[_4_]

auto open workbook to make read-only
 
I want to manually open a protected workbook and for it to open read-only
with out a dialog box.

If the above requires the use of the auto_open event, how do I turn this off
when I open the protected workbook programmatically?

I'm using excel 2003

ryguy7272

auto open workbook to make read-only
 
For an old post:
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

Hit Alt+F11, double-click 'ThisWorkbook' and paste the code in there.
Finally, File|SaveAs|tools|general options|check that "read-only recommended"
box.

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tim C" wrote:

I want to manually open a protected workbook and for it to open read-only
with out a dialog box.

If the above requires the use of the auto_open event, how do I turn this off
when I open the protected workbook programmatically?

I'm using excel 2003


ryguy7272

auto open workbook to make read-only
 
FROM an old post...
http://www.microsoft.com/office/comm...=en-us&m=1&p=1

Should have just pasted the link in there last time...

Best of luck to you!
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"ryguy7272" wrote:

For an old post:
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

Hit Alt+F11, double-click 'ThisWorkbook' and paste the code in there.
Finally, File|SaveAs|tools|general options|check that "read-only recommended"
box.

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tim C" wrote:

I want to manually open a protected workbook and for it to open read-only
with out a dialog box.

If the above requires the use of the auto_open event, how do I turn this off
when I open the protected workbook programmatically?

I'm using excel 2003


Tim C[_3_]

auto open workbook to make read-only
 
Thanks for the help but this does not suppress the initial dialogue box
asking to read only or not. Also sub auto-open() does not work for me whereas
sub workbook auto_open does? Why is this? The only way I can get around this
is not to have the workbook saved password protected or readonly but make it
readonly automatically on the auto-open using the code:

Private Sub Workbook_Open()
ThisWorkbook.ChangeFileAccess xlReadOnly
End Sub


Cheers, Tim



ryguy7272" wrote:

For an old post:
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

Hit Alt+F11, double-click 'ThisWorkbook' and paste the code in there.
Finally, File|SaveAs|tools|general options|check that "read-only recommended"
box.

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tim C" wrote:

I want to manually open a protected workbook and for it to open read-only
with out a dialog box.

If the above requires the use of the auto_open event, how do I turn this off
when I open the protected workbook programmatically?

I'm using excel 2003



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com