G
Guest
The following worked until I had to add the second line (Oops) for laptops
away from the facility. It still functions properly but I get en error
message. What is the correct to fix this problem?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If Response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text + "
" + (BookName))
On Error GoTo Oops
ActiveWorkbook.SaveCopyAs Filename:="\\Wizard\Emerald
Calibrations\Current Year\" & Range("BckUp").Text
Oops:
ActiveWorkbook.SaveCopyAs Filename:="\Emerald Calibrations\Current
Year\" & Range("BckUp").Text
ElseIf Response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ThisWorkbook.Saved = True
End Sub
TIA
Lou
away from the facility. It still functions properly but I get en error
message. What is the correct to fix this problem?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If Response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text + "
" + (BookName))
On Error GoTo Oops
ActiveWorkbook.SaveCopyAs Filename:="\\Wizard\Emerald
Calibrations\Current Year\" & Range("BckUp").Text
Oops:
ActiveWorkbook.SaveCopyAs Filename:="\Emerald Calibrations\Current
Year\" & Range("BckUp").Text
ElseIf Response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ThisWorkbook.Saved = True
End Sub
TIA
Lou