Hi all,
I have been using the following code as an after save event.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.EnableEvents = False
Application.ScreenUpdating = False
'run code to hide sheets, columns etc.
ThisWorkbook.Save
'run code to redisplay sheets etc.
Application.ScreenUpdating = True
Application.EnableEvents = True
Cancel = True 'cancel original save request
End Sub
Does anyone know of another or better way to achieve this?
Can anyone suggest any scenerio where this will fail or get an error?