ThisWorkbook.Save not working under Workbook_BeforeSave, Help!
Hi Michel
code works for me. How do you recognize that this won't save your file?
--
Regards
Frank Kabel
Frankfurt, Germany
Michel wrote:
Why doesn't the workbook get saved here ?
Private Sub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, Cancel As
Boolean)
Application.EnableEvents = False
ThisWorkbook.Worksheets("Sales").Protect Password:="123",
UserInterfaceOnly:=True, Scenarios:=True, Contents:=True
ThisWorkbook.Save
ThisWorkbook.Worksheets("Sales").Unprotect Password:="123"
Cancel = True
Application.EnableEvents = True
End Sub
This sub get's called with ThisWorkbook.Save and debug does step
through it all the way, only it doesn't get saved?!
Thanks.
|