Message box

T

TooN

Hi..

Ive got a small lillte macro that traces predecessors and successors. I want
a message box when there are no predecessors or successors available. Here is
the macro:

Sub TRACE_Successors()
Dim Job As Task
Dim Base As Task
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Flag7 = False
End If
Next Job
Set Base = ActiveSelection.Tasks(1)
Base.Flag7 = True
For Each Job In Base.SuccessorTasks
Job.Flag7 = True
FilterApply Name:="Trace", Highlight:=False
Next Job
End Sub

Can anybody help me that if there are no pre of successors a message box
will show up!!

Thanks
 
R

Rod Gill

Hi,

In future please use the Project.programming group. I would code this as:

Sub TRACE_Successors()
Dim Job As Task
Dim Base As Task
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Flag7 = False
End If
Next Job
Set Base = ActiveSelection.Tasks(1)
If Base.SuccessorTasks.Count = 0 Then
MsgBox "No successors", vbOKOnly + vbInformation
Else
Base.Flag7 = True
For Each Job In Base.SuccessorTasks
Job.Flag7 = True
Next Job
FilterApply Name:="Trace", Highlight:=False
End If
End Sub


--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more

NEW!! Project VBA Book now in stock, for details visit:
www.projectvbabook.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top