DisplayAlerts = false not working

  • Thread starter Thread starter Mark Stephens
  • Start date Start date
M

Mark Stephens

I made my workbook read only so that users cannot select the chart on a
chart sheet. Now when I open my workbook it displays a message:

'Workbook should be opened as read only unless you intend to save changes to
it. Open as read only?'

I put Application.DisplayAlerts = False in the OnOpen code first line but it
wont go away. Does anyone know how to get rid of it ?

Any help much appreciated, kind regards, Mark
 
The code in your procedures run after the workbook is opened--so it's already
too late.
 
Hi

One way around it is to use another workbook to open your read only
workbook.

Use code like this in another blank workbook that does nothing but open your
read-only workbook.

Private Sub Workbook_Open()
Application.DisplayAlerts = False
Workbooks.Open "your_workbooks_name.xls"
End Sub


HTH

Ken
 
You could use ChangeFileAccess method in your OnOpen statement to change the
file to readonly after its opened.

ThisWorkBook.ChangeFileAccess Mode:=xlreadonly

Of course, your users could get around this by holding the Shift key when
they open the file (causing auto open macros to not run), but they can also
get around read only using Save As to save a copy of the file w/o the read
only property set.

Whatever method you use, just be sure you know how to open the file
read/write.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top