Me.Saved on Read Only files

moogthemoog

Board Regular
Joined
Nov 17, 2004
Messages
51
Hi

I'm using code so that when a workbook is read only, it treats it as saved, so the Save prompt doesn't come up. This is in in BeforeClose event.

However, if a user opens the spreadsheet (as read only) and does work in it, without bearing in mind it's only read only, then it would not come up with a prompt to save.

Some processes seem to run (I think it's Conditional Formatting) when opening the file, that mean the spreadsheet always thinks there's something to save.

What I would like to know, therefore, is if there is a open event that will trigger when the workbook is opened, but after the automated processes finish, so that I can put a Me.Saved = True line in? Or even, in the BeforeClose event, if there's something that can differentiate between user-activated changes, or the spreadsheet-originated changes.

Code:
Private Sub Workbook_beforeclose(cancel As Boolean)
If ActiveWorkbook.ReadOnly = False Then GoTo 50
Me.Saved = True

Exit Sub

50: 'Etc
End Sub

Obviously, I can just switch off this code, but I'm trying to eliminate unnecessary prompts to save.

Thanks
Jon
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top