I
Incanus
Hello:
I've created a small VBA program for Project Professional 2007 in
order to implement massive publishing automation tasks.
The program uses a list of names of Gantts currently available in
Project Server, each one created as an individual Project task. The
task list is written in the same MPP file that contains the VBA
program.
As the Project Professional session is already logged with Project
Server, the VBA program simply loads each Gantt from the list on
Project Professional, attempts to publish it and then closes the
Gantt.
"The rub" is that, on receiving the publish VBA command, Project
Professional opens the publishing window, awaiting for a user click on
the Publish button.
Thus, a batch process becomes an interactive process... which defeats
a big part of the program functionality.
Here follows the VBA code for Project Professional 2007:
Sub Publicacion_Normal()
' Publicacion_Normal
Dim Tarea As Task
Dim Gantt As String
' Each task corresponds to a Gantt in Project Server that needs
publishing
For Each Tarea In ActiveProject.Tasks
' Creating the loading string for the given Gantt
Gantt = "<>\" & Tarea.Name
' Opening the given Gantt from Project Server
FileOpenEx Name:=Gantt, ReadOnly:=False
'Save the given Gantt before publishing it
FileSave
'Publishing the given Gantt
Publish
'SendKeys "{ENTER}"
'Waiting for the publishing process to be finished
TiempoPausa = 20
Inicio = Timer
Do While Timer < Inicio + TiempoPausa
DoEvents
Loop
'Closing the given Gantt in protected state
FileClose Save:=pjDoNotSave, NoAuto:=True
Next Tarea
End Sub
Note that the 'SendKeys "{ENTER}" command was an attempt to force a
click on the publishing window's Publish button (it didn't work).
I'll welcome any indication that could help me solve this problem.
Thanks in advance,
Sebastián Armas
Project Manager
I've created a small VBA program for Project Professional 2007 in
order to implement massive publishing automation tasks.
The program uses a list of names of Gantts currently available in
Project Server, each one created as an individual Project task. The
task list is written in the same MPP file that contains the VBA
program.
As the Project Professional session is already logged with Project
Server, the VBA program simply loads each Gantt from the list on
Project Professional, attempts to publish it and then closes the
Gantt.
"The rub" is that, on receiving the publish VBA command, Project
Professional opens the publishing window, awaiting for a user click on
the Publish button.
Thus, a batch process becomes an interactive process... which defeats
a big part of the program functionality.
Here follows the VBA code for Project Professional 2007:
Sub Publicacion_Normal()
' Publicacion_Normal
Dim Tarea As Task
Dim Gantt As String
' Each task corresponds to a Gantt in Project Server that needs
publishing
For Each Tarea In ActiveProject.Tasks
' Creating the loading string for the given Gantt
Gantt = "<>\" & Tarea.Name
' Opening the given Gantt from Project Server
FileOpenEx Name:=Gantt, ReadOnly:=False
'Save the given Gantt before publishing it
FileSave
'Publishing the given Gantt
Publish
'SendKeys "{ENTER}"
'Waiting for the publishing process to be finished
TiempoPausa = 20
Inicio = Timer
Do While Timer < Inicio + TiempoPausa
DoEvents
Loop
'Closing the given Gantt in protected state
FileClose Save:=pjDoNotSave, NoAuto:=True
Next Tarea
End Sub
Note that the 'SendKeys "{ENTER}" command was an attempt to force a
click on the publishing window's Publish button (it didn't work).
I'll welcome any indication that could help me solve this problem.
Thanks in advance,
Sebastián Armas
Project Manager