help with macro
Sorry for the misunderstanding, seemingly you cant have 2 before save events
or you will get an ambiguous error, any ideas on resloving. Below is all my
code.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Call ProtectAllSheets
End Sub
Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="****"
Next n
Application.ScreenUpdating = True
End Sub
Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="****"
Next n
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim SH As Object
Dim SH2 As Object
With Me
Set SH = .Sheets("Sheet3")
Set SH2 = .Sheets("Sheet8")
End With
SH.PageSetup.RightFooter = Format(Now, "dd-mmm-yy")
SH2.PageSetup.RightFooter = "Relief Shifts " & Format(Now,
"dd-mmm-yy")
End Sub
Many thanks
"Norman Jones" wrote:
Hi Santaviga,
You misunderstand me!
Please copy all the code from the
Thisworkbook module and paste it
into a reply in this thread.
In this way, we can see all of your
code and give you a definitive version
to resolve your problem.
---
Regards.
Norman
"santaviga" wrote in message
...
Hi Norman,
I have copied and pasted the code, returning ambiguous error name in
before
save, as I said I have another before save macro running, will this affect
the code?
Regards
"Norman Jones" wrote:
Hi Santaviga,
Try to copy / paste the code from the
Thisworkbook module.
---
Regards.
Norman
"santaviga" wrote in message
...
This has been done but still error.
"Norman Jones" wrote:
Hi Santaviga,
Change:
"Other Shifts " _
& Format(Now, "dd-mmm-yy") '<<==== CHANGE
to
Format(Now, "dd-mmm-yy")
---
Regards.
Norman
|