I have the following code behind 'This Workbook'.
My problem is that the check it is running returns true as the file is still called 'Q0 Template' so it won't let me save as another file.
the code that fires this off is
Anyone know how to resolve this?
Thanks
My problem is that the check it is running returns true as the file is still called 'Q0 Template' so it won't let me save as another file.
the code that fires this off is
Code:
wbTemplate.SaveAs strYearFolder & "\" & strForecast & " " & strPeriod
Thanks
Code:
Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.Name = "Q0 Template.xls" And Worksheets.Count > 9 Then
MsgBox ("You are attempting to save this file as the Template workbook." & vbCr & vbCr & _
"If this file contains data then save the file with another name," & vbCr & _
"otherwise close this file without saving."), vbExclamation
Cancel = True
Exit Sub
Else
End If
End Sub