E
Eric Frederich
Hello,
I'm not a VB guy or really a Project Server guy but I have been tasked with
writing a little macro to open, calculate, save, and publish every project in
our database.
For some projects this is straight forward but for others there are modal
prompts which freeze this automation such as "The currency for this project
is different from the currency specified in the enterprise global.....
....Click Yes to overwrite this project's currency setting with that of the
enterprise global or click No to keep this project's setting."
Also, sometimes even though I'm doing a "FileSave" right before my
"Application.PublishAllInformation", I am still prompted sometimes saying
"When publishing to Project Server, your project will be saved. Do you want
to proceed?"
Basically, I'd like to know how (if it is possible) to bypass some of the
prompts that I'm getting so that I can spin through all of the projects in
the database without having someone sitting there clicking "yes", "yes",
"yes".
Below is a code excerpt. When the form loads it populates a ListBox with
all of the project names which it gets from an SQL query on the database.
Those project names are stored in ListBox1.List(i,0)
Thanks in advance,
~Eric
Private Sub ProcessSelectedButton_Click()
MsgBox "ListCount : " & ListBox1.ListCount
For i = 0 To ListBox1.ListCount - 1 Step 1
If ListBox1.Selected(i) Then
ListBox1.List(i, 1) = "selected"
FileOpen "<>\" & ListBox1.List(i, 0) 'Opens enterprise project
ListBox1.List(i, 1) = "FileOpen complete"
Application.CalculateProject
ListBox1.List(i, 1) = "CalculateProject complete"
FileSave ' doing a save here gets rid of the prompt caused by
publishing an unsaved project
ListBox1.List(i, 1) = "FileSave complete"
' Sometimes even though we saved the project above, we are still
asked ...
' "When publishing to Project Server, your project will be
saved. Do you want to proceed?"
Application.PublishAllInformation
ListBox1.List(i, 1) = "PublishAllInformation complete"
FileClose pjDoNotSave ' no need to save again
ListBox1.List(i, 1) = "FileClose complete"
Else
ListBox1.List(i, 1) = "-"
End If
Next i
End Sub
I'm not a VB guy or really a Project Server guy but I have been tasked with
writing a little macro to open, calculate, save, and publish every project in
our database.
For some projects this is straight forward but for others there are modal
prompts which freeze this automation such as "The currency for this project
is different from the currency specified in the enterprise global.....
....Click Yes to overwrite this project's currency setting with that of the
enterprise global or click No to keep this project's setting."
Also, sometimes even though I'm doing a "FileSave" right before my
"Application.PublishAllInformation", I am still prompted sometimes saying
"When publishing to Project Server, your project will be saved. Do you want
to proceed?"
Basically, I'd like to know how (if it is possible) to bypass some of the
prompts that I'm getting so that I can spin through all of the projects in
the database without having someone sitting there clicking "yes", "yes",
"yes".
Below is a code excerpt. When the form loads it populates a ListBox with
all of the project names which it gets from an SQL query on the database.
Those project names are stored in ListBox1.List(i,0)
Thanks in advance,
~Eric
Private Sub ProcessSelectedButton_Click()
MsgBox "ListCount : " & ListBox1.ListCount
For i = 0 To ListBox1.ListCount - 1 Step 1
If ListBox1.Selected(i) Then
ListBox1.List(i, 1) = "selected"
FileOpen "<>\" & ListBox1.List(i, 0) 'Opens enterprise project
ListBox1.List(i, 1) = "FileOpen complete"
Application.CalculateProject
ListBox1.List(i, 1) = "CalculateProject complete"
FileSave ' doing a save here gets rid of the prompt caused by
publishing an unsaved project
ListBox1.List(i, 1) = "FileSave complete"
' Sometimes even though we saved the project above, we are still
asked ...
' "When publishing to Project Server, your project will be
saved. Do you want to proceed?"
Application.PublishAllInformation
ListBox1.List(i, 1) = "PublishAllInformation complete"
FileClose pjDoNotSave ' no need to save again
ListBox1.List(i, 1) = "FileClose complete"
Else
ListBox1.List(i, 1) = "-"
End If
Next i
End Sub