PC Review


Reply
Thread Tools Rate Thread

auto open workbook to make read-only

 
 
Tim C
Guest
Posts: n/a
 
      8th May 2009
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 With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      10th May 2009
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 With Quote
 
ryguy7272
Guest
Posts: n/a
 
      10th May 2009
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

 
Reply With Quote
 
Tim C
Guest
Posts: n/a
 
      10th May 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
File permissions on Excel Workbook -- make only owner/admin read/w Janet Panighetti Microsoft Excel Discussion 2 24th Dec 2009 01:45 AM
How to Protect my workbook (make it read only for users) Dee Microsoft Excel Misc 0 6th Oct 2008 04:29 AM
Can you make excel auto save your workbook? =?Utf-8?B?UmhpYW5ub24=?= Microsoft Excel Misc 4 26th Oct 2004 10:39 PM
How to make the opening a workbook conditional upon the value of cell in another open workbook Marcello do Guzman Microsoft Excel Programming 2 20th Mar 2004 01:56 PM
How do I make an open workbook the active workbook Todd@sympatico.ca Microsoft Excel Programming 1 30th Dec 2003 04:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:56 PM.