Disable option save when close excel

  • Thread starter Thread starter Rui Alvares
  • Start date Start date
R

Rui Alvares

Hi,

I'm making a macro that open an excel document only for consulting.
So, if anybody makes changes in it, the changes can not be saved.
For that, when the document is closed, I need inhibit the window asking if
we want save it.
If anybody knows how make it, I'm very pleasure.

Thamks in advance.

Rui Álvares
 
Re: Exit without saving
Posted by Mark O'Brien on September 27, 2001 11:53 AM

Insert this code onto the workbook object
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Me.Saved = False Then Me.Saved = True
End Sub

that should work.
 
Just a thought for the OP if looking for a reliable method, if Macros are
disabled, then this will not work.

You might make the workbook ReadOnly (although this can be defeated as
well).
 

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