S
Sean
At my work we use Project Server 2003. When we accept updates for
projects, Project opens up each file, makes the changes, and saves
them. But when we close the files, project always wants us to save
them. It gets annoying. So I wrote a macro to go through all the
projects and close them until either they are all gone or the only one
left is 'Project1', the default. But I don't have tons of confidence
in my VB coding skills yet, and want to run this macro by some experts
and see if there are some obvious holes or oversights on my part.
Here's the code:
Sub NextSaveClose()
Dim count As Integer
Dim I As Integer
Dim J As Integer
Dim compare As Integer
count = Windows.count
I = 0
Do While Application.Windows.count > I
If Windows.ActiveWindow.Caption <> "Project1" Then
FileSave
FileClose 'should I add something here in case the file
cannot save for some reason?
Else
I = 1
J = Windows(I).Index
Windows.ActiveWindow.Visible = False 'moves to next
active window
End If
Loop
Windows(J).Visible = True 'brings back project1
End Sub
Thanks for your help!
~Sean
projects, Project opens up each file, makes the changes, and saves
them. But when we close the files, project always wants us to save
them. It gets annoying. So I wrote a macro to go through all the
projects and close them until either they are all gone or the only one
left is 'Project1', the default. But I don't have tons of confidence
in my VB coding skills yet, and want to run this macro by some experts
and see if there are some obvious holes or oversights on my part.
Here's the code:
Sub NextSaveClose()
Dim count As Integer
Dim I As Integer
Dim J As Integer
Dim compare As Integer
count = Windows.count
I = 0
Do While Application.Windows.count > I
If Windows.ActiveWindow.Caption <> "Project1" Then
FileSave
FileClose 'should I add something here in case the file
cannot save for some reason?
Else
I = 1
J = Windows(I).Index
Windows.ActiveWindow.Visible = False 'moves to next
active window
End If
Loop
Windows(J).Visible = True 'brings back project1
End Sub
Thanks for your help!
~Sean