Saving a backup copy of Project file to a specified path in VBA
Hi,
I am fairly familiar with Excel VBA but not so much with Project.
With some of my Excel files I have a VBA routine to save a backup copy of the file:
Code:
Public Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Dim MyBackupPath As String
MyBackupPath = "C:\Backups\"
ActiveWorkbook.SaveCopyAs MyBackupPath & Format(Now, "dd.mm.yy - h.mm AM/PM") & " - " & Application.UserName & " " & ActiveWorkbook.Name
If ThisWorkbook.Saved = False Then
ThisWorkbook.Save
End If
Application.DisplayAlerts = True
End Sub
I would like to do the same with a MS Project file but after having changed the obvious "ActiveWorkbook" to "ActiveProject" I'm still getting runtime errors on that line.
Please can anyone point out what I'm doing wrong?
Thanks