moogthemoog
Board Regular
- Joined
- Nov 17, 2004
- Messages
- 51
I have a Spreadsheet that has Read Only Recommended. When a user wants to Save it, I want a new Filename entered by the user, and to make sure that the Read-Only Recommended status is switched off (i.e. Read-Write always On)
Although my users can do this by File-SaveAs, most of them forget to switch the Read only recommended status off in the SaveAs dialog box.
What would be the code for this? My code below falls over on the Workbook.SaveAs line. I'm trying to use xlDialogSaveAs as the filename, but it's failing also!
Although my users can do this by File-SaveAs, most of them forget to switch the Read only recommended status off in the SaveAs dialog box.
What would be the code for this? My code below falls over on the Workbook.SaveAs line. I'm trying to use xlDialogSaveAs as the filename, but it's failing also!
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.EnableEvents = False
Application.Dialogs(xlDialogSaveAs).Show
If Not Me.ReadOnly Then
Workbook.SaveAs Filename:=xlDialogSaveAs, ReadOnlyRecommended:=False
End If
SaveAsUI = False
Cancel = True
Application.EnableEvents = True
End Sub