Thanks Rod. I created my master plan to have all of the inserted project
plans minimized so that they don't try to open anything. Then I have my
macro do the FileOpen as you stated:
DisplayAlerts = False
FileOpen "C:\PMO\Project1.mpp", False, , , , , , , , , , pjDoNotOpenPool,
, "password", True
Then I call my NightlyPlanReview macro. What I don't feel is very clean
about my first attempt is how I decide to SAVE or NOT SAVE project plans. I
need to make this decision because sometimes people leave their project plans
open before the go home at night (and there's always the chance that they
have it open while I'm running my macro on all the plans and so I don't want
to save over their changes should they happen to save right during my macro
run). Here's what I do so far:
Sub SaveThisFile(originalFile As String, tempfile As String, saveflag As
Variant, tempProject As Variant)
'originalFile is the path/filename of the original file location
'tempfile is the path/filename of the current file location where the
macro run took place
'tempProject is the .Project name of the project that is now being saved
Dim i, iprev As Integer
If saveflag Then
'set ActiveProject to be the tempfile project
i = ActiveProject.Index
On Error Resume Next
Do Until ActiveProject.Name = tempProject
If i < 50 Then
i = i + 1
Projects(i).Activate
Else
i = 1
Projects(i).Activate
End If
Loop
'save the tempfile
FileClose pjSave
Else
On Error Resume Next
'close tempfile without a save
FileClose pjDoNotSave
End If
On Error GoTo 0
End Sub
It works, but I don't like that I had to force using <50 rather than taking
advantage of something like Projects.Count; but this didn't work because as I
FileClose various projects, Project.Count would reduce and sometimes I ran
into trouble where the Project.Index that I needed was a larger number than
what Projects.Count currently showed.
Is there a cleaner way to SAVE and CLOSE the project plans that I determine
as needing to be saved, and simply CLOSE the other plans.
Thanks again. By the way, is there a Timer available for use in MS Project?
I need to launch this at 3AM.