Let's see. First, you want to enable macros, otherwise the macro won't
run.
The #error appears to be related to the formulas. Did you use the
exact
custom field names that I specified? If not, the names in the
formulas
need
to be updated. Also, might want to double-check for all the
parentheses,
etc.
I think you are really close. Keep me posted.
TGG
blog:
http://spaces.msn.com/members/evildoctorporkchop
:
Hi TGG,
Many thanks for your continued input on this query.
Well I managed to set the Macro Security to low and re-started
MOPP2003.
I
opened the Ent Global and did ALT+F11 to display the Visual Basic
Window
Macro. It displayed the ThisProject(EnterpriseGlobal) node. I then
clicked
the View Code button which appears immediately above the
Project-VBAProject
window and in the pane on the right hand side pasted the script you
provided. I clicked the Save button and then ALT+Q to return to
MOPP2003.
When I next started up MOPP2003 I got the Security Warning dialogue
box
which I assume indicates that my Macro is present? If I am in a
session
of
MOPP2003 with Macros disabled and then open the Enterprise Global I
get
the
security warning and once in the Ent Global if I go ALT+F11 I can see
the
script for the Macro displayed in the pane on the right hand side.
However I do not appear to be getting this Macro to perform as
expected.
When I open a project plan and display the "Phase" table I have
created
the
Phase Flag field says No by default and the Phase Date and Current
Phase
columns display #ERROR in all rows. Changing a flag on a Milestone to
Yes
clears the #ERROR values from all non-milestone unflagged tasks,
however
summary tasks still show #ERROR and the Current Phase column shows no
values
or #ERROR at all. Do the Summary Task and corresponding Milestone need
to
have exactly the same text value?
I assume there is a simple answer to this which I am missing due to a
lack
of Macro knowledge and hope you can help.
--
Dominic Moss
www.projectability.co.uk
Helping people achieve more with Microsoft Project
Tel +44 8707 303 400
Fax +44 8707 303 500
Dominic,
I neglected to mention that macro security must be set to either
Medium
or
Low. Sorry about that. I prefer Medium since that provides the
user
with
a
measure of control when opening unfamilar project plans.
In Project Pro, go to Tools, Macro, Macro Security and set
appropriately.
You may also want to restart Project as a prudent measure.
I'm assuming you know how to get the macros into the macro editor,
yes?
If
not, press Alt+F11 in Project Pro to bring up the VB editor. The
"ThisProject" entry under VBAProject([name of open project]),
Microsoft
Project Objects should be selected in the left pane. Open it if it
is
not
already open. Paste in the code. Save the project. You should be
good
to
go. If this doesn't help, let me know.
Thanks!
TGG
blog:
http://spaces.msn.com/members/evildoctorporkchop
new Project 12 blog:
http://blogs.msdn.com/dieterz/
:
TGG,
That was a really useful answer as I have been trying to figure out
how
to
do this for a while now. I have followed your instructions but have
to
admit
I am not "comfortable" with Macros.
I have documented my actions in following your instructions from
the
custom
Flag field through to the Date field - I am assuming that these
should
use
Enterprise Task Flag, Text and Date fields in the Enterprise
Global, I
have
also created a new table to display these fields. I have tried to
create
a
Macro using your posted content in the Enterprise Global but am
having
problems, can I ask you to provide an idiots step by step guide as
to
how
to
complete this?
--
Dominic Moss
www.projectability.co.uk
Helping people achieve more with Microsoft Project
Tel +44 8707 303 400
Fax +44 8707 303 500
Try this. We did something similar using milestones (Feasibility
Phase
milestone, etc.) and whether or not they were completed to denote
current
phase. We also wanted the info to show up in a PWA Project
Center
view
so
that the person could export via Excel 2003. So, it had to be in
the
Project
Summary task. This has not been fully tested, so your mileage
may
vary.
Please use it as a demo to give you other ideas.
Here's the steps for setup.
1. Customize a Flag field to denote which milestones you want to
evaluate.
For purposes of illustration, use Flag1 to do this. Then mark
the
milestones
to evaluate.
2. Customize Date2 to use the following formula and to rollup
the
Maximum
value.
IIf([Flag1]=Yes And [Finish]>DateValue([Current Date]) And [%
Complete]<>100
And [% Complete]>0,ProjDateValue([Finish]),ProjDateValue('NA'))
This
puts
the finish date of the current phase milestone into this field.
3. Customize Text 1 with the following formula:
IIf(ProjDateValue([Date2])<>ProjDateValue('NA') And
[Summary]=No,[Name],"")
This retrieves the name description of the current phase
milestone.
4. Lastly, add the following macro code to move the Text 1 value
to
the
Project Summary rollup. You can't rollup text values for some
reasons
without this.
Private Sub Project_BeforeSave(ByVal pj As MSProject.Project)
Dim t As Task
On Error GoTo ErrorHandler
Application.CalculateAll
For Each t In ActiveProject.Tasks
If t.Text1 <> "" Then
SetTaskField Field:="Text1", Value:=t.Text1, TaskID:="0"
End If
Next t
GoTo EndSub
ErrorHandler:
MsgBox Prompt:="Error Number: " & Err.Number,
Buttons:=vbCritical, _
Title:="Set of Milestone To Summary Level Macro Error"
EndSub:
End Sub
If you autopublish, the values will get published to PWA
automatically.
Otherwise, you have to remember to publish.
I hope this helps.
TGG
blog:
http://spaces.msn.com/members/evildoctorporkchop
:
Dan,
Does the "Current Phase" value calculate correctly in Microsoft
Project
itself? I have been trying to design the same feature myself and
my
postings
drew a blank. If the value in MS Project calculates correctly
you
are
closer
to resolution than I am.
To test the value is correct you could create a new table that
includes
the
Enterprise Project Text field, it will show the same value
against
every
task in your project plan. If it is delivering the correct value
then
check
how your Project Centre view is defined - Enterprise Project
fields
can
be
used in these views whereas Enterprise Task fields will display
in
a
Project
View.
I hope this is of some assistance, please let me know how you
get
on.
Dominic Moss
www.projectability.co.uk
Helping people achieve more with Microsoft Project
Tel +44 8707 303 400
Fax +44 8707 303 500
message
Greetings All
I am relatively new to Project Server and are attempting to
use a
Enterprise
Project Text field (which I have renamed Current Phase) to
hold a
value
which
indicates the phase of the project. I have implemented a
Enterprise
Task
Flag
that indicates whether a Task is completed, based on the %
complete
field.
I
have then tried to use that flag inconjunction with the Task
name
to
calculate the current phase and store that in 'Current Phase'.
I
have
Opened,
re-calculated and re-published a project, but the 'Current
phase'
field
is
blank when view in a custom view on PWA.