Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use hyperlink to open workbook read only? Clif McIrvin[_2_] Excel Discussion (Misc queries) 3 April 9th 10 02:48 AM
How to Protect my workbook (make it read only for users) Dee Excel Discussion (Misc queries) 0 October 6th 08 04:29 AM
Read Only Message for open workbook Les Excel Programming 1 March 17th 08 07:42 PM
Make excel open file without Read Only dialog Saul Margolis Excel Discussion (Misc queries) 2 March 16th 05 03:30 PM
workbook open read only without prompt turbogoat Excel Programming 1 August 26th 04 10:44 PM


All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"