Chis44
03-22-2015, 08:21 AM
Hi,
I've searched high and low and cannot find a solution to formatting Milestones. I can't even seem to find that there is a known issue with the method. I've tried recording the VBA and playing it back but I receive a 1101 - Argument is invalid message. The vba that is recorded is as follows.
GanttBarFormatEx StartShape:=3, StartType:=0, StartColor:=255, MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0, EndShape:=0, EndType:=0, EndColor:=0, RightText:="Task Finish"
If I try and format a normal bar it works perfectly but the milestones just do not seem to take the method.
I've supplied some sample code below that works when it is not a milestone (that bit is not supplied) but just does not work when it is a milestone. N.B. This is sample code that represents the type of thing I want to do, but I can't supply the full code so have written this little test harness.
Does anyone have a solution for this?
Sub markMilestone()
Dim mTask As Task
For Each mTask In ActiveProject.Tasks
If mTask.Milestone = True Then
GanttBarFormat TaskID:=mTask.ID, startshape:=pjStar, starttype:=pjSolid, _
startcolor:=pjRed, middleshape:=pjNone, endshape:=pjNone
End If
Next mTask
End Sub
Kind Regards,
Stu
I've searched high and low and cannot find a solution to formatting Milestones. I can't even seem to find that there is a known issue with the method. I've tried recording the VBA and playing it back but I receive a 1101 - Argument is invalid message. The vba that is recorded is as follows.
GanttBarFormatEx StartShape:=3, StartType:=0, StartColor:=255, MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0, EndShape:=0, EndType:=0, EndColor:=0, RightText:="Task Finish"
If I try and format a normal bar it works perfectly but the milestones just do not seem to take the method.
I've supplied some sample code below that works when it is not a milestone (that bit is not supplied) but just does not work when it is a milestone. N.B. This is sample code that represents the type of thing I want to do, but I can't supply the full code so have written this little test harness.
Does anyone have a solution for this?
Sub markMilestone()
Dim mTask As Task
For Each mTask In ActiveProject.Tasks
If mTask.Milestone = True Then
GanttBarFormat TaskID:=mTask.ID, startshape:=pjStar, starttype:=pjSolid, _
startcolor:=pjRed, middleshape:=pjNone, endshape:=pjNone
End If
Next mTask
End Sub
Kind Regards,
Stu