klandreth
08-09-2012, 07:00 AM
Hello again.
I've scoured the Internet for examples of how to save / make a backup copy of the current workbook. However, my code is either generating an error ("1004) or simply not working (no file is saved).
What did I miss? :banghead:
Sub Consolidate()
Dim exApp As Excel.Application
Dim exDoc As Excel.Workbook
Dim sCurrentFileName, sBackupFileName, sCurrentDateTime As String
Application.DisplayStatusBar = True
sCurrentFileName = ActiveWorkbook.Name
sCurrentDateTime = Format (Date, "yyyymmdd") & "_" & Format (Time, "hhmmss")
sBackupFileName = sCurrentDateTime & "_" & sCurrentFileName
ActiveWorbook.SaveCopyAs (sBackupFileName)
MsgBox ("Backup File is " & sBackupFileName)
Application.StatusBar "Backup File is " & sBackupFileName
End Sub
I've scoured the Internet for examples of how to save / make a backup copy of the current workbook. However, my code is either generating an error ("1004) or simply not working (no file is saved).
What did I miss? :banghead:
Sub Consolidate()
Dim exApp As Excel.Application
Dim exDoc As Excel.Workbook
Dim sCurrentFileName, sBackupFileName, sCurrentDateTime As String
Application.DisplayStatusBar = True
sCurrentFileName = ActiveWorkbook.Name
sCurrentDateTime = Format (Date, "yyyymmdd") & "_" & Format (Time, "hhmmss")
sBackupFileName = sCurrentDateTime & "_" & sCurrentFileName
ActiveWorbook.SaveCopyAs (sBackupFileName)
MsgBox ("Backup File is " & sBackupFileName)
Application.StatusBar "Backup File is " & sBackupFileName
End Sub