burley
03-09-2009, 01:51 AM
Hi,
I'm a novice, and I have a spreadsheet that I want users to save only via a button on the worksheet. I have found code that prevents saving, which is great:-
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "This workbook can ONLY be saved with the Save Button"
Cancel = True
End Sub
but then my save as Macro wont work either...
Sub Saveasdate()
Dim strName As String
Dim strPath As String
Application.DisplayAlerts = False
strName = Range("AL3").Value
strPath = ActiveWorkbook.Path
ActiveWorkbook.SaveAs Filename:=strPath & "\" & strName, FileFormat:=xlNormal
End Sub
Can someone help me to do this better, or somehow turn saving back on when I need it?
Thank you
I'm a novice, and I have a spreadsheet that I want users to save only via a button on the worksheet. I have found code that prevents saving, which is great:-
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "This workbook can ONLY be saved with the Save Button"
Cancel = True
End Sub
but then my save as Macro wont work either...
Sub Saveasdate()
Dim strName As String
Dim strPath As String
Application.DisplayAlerts = False
strName = Range("AL3").Value
strPath = ActiveWorkbook.Path
ActiveWorkbook.SaveAs Filename:=strPath & "\" & strName, FileFormat:=xlNormal
End Sub
Can someone help me to do this better, or somehow turn saving back on when I need it?
Thank you