how to convert this into a simple Find command of some sort?

A

andy.novak

Is there a more efficient way to do below? A FIND statement or
something similar than looping through all assignments for a task to
see if an enterprise resource has been assigned already? Please give
example.

Thanks,
Andy Novak
UNT


ResMatch = 0
For Each assn In t.Assignments
If assn.ResourceName = res.Name
Then
ResMatch = ResMatch + 1
End If
Next assn
If ResMatch = 0 Then
t.Assignments.Add
ResourceID:=res.ID, Units:=0
End If
 
R

Rod Gill

Hi Andy,

ResMatch = ResMatch + 1
Exit For

will speed the process up a little. You do need to loop thru each assignment
unless you have the Assignment ID.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://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