Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,124
- Office Version
- 365
- Platform
- Windows
Good Day All,
I'm using the sub SaveAsXLSM below to create a new workbook based upon the date.
At times depending upon the computer speed provides a "Book1 - Excel" file as an error file.
My question is, how do prevent this type of event/error from happening?
For example,
Please let me know.
Thank you!
pinaceous
I'm using the sub SaveAsXLSM below to create a new workbook based upon the date.
VBA Code:
Dim strName As String
strName = ThisWorkbook.Path & "\" & Format(Date, "DDMMMYYYY ") & Sheet1.Name & " " & ".xlsm"
ActiveSheet.Copy
ThisWorkbook.SaveAs FileName:=strName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close savechanges:=False
At times depending upon the computer speed provides a "Book1 - Excel" file as an error file.
My question is, how do prevent this type of event/error from happening?
For example,
VBA Code:
On Error GoTo Whoa
'code
LetsContinue:
If strWBName = "Book1.xlsx" created Then
Don't
Application.ScreenUpdating = True
Application.EnableEvents = True
Exit Sub
Whoa:
'MsgBox Err.Description
Resume LetsContinue
Please let me know.
Thank you!
pinaceous