Task assignments through VBA

Q

question

Hi,

I am tryign to assign a user to a task using VBA( project 2007)

For Each tsk In ActiveProject.Tasks
On Error Resume Next
If Not tsk Is Nothing Then
cf = tsk.GetField(FieldNameToFieldConstant("Deliverable_Type"))
If cf = "Interpretation" Then
tsk.Assignments.Add ResourceID:=RID
End If
End If
Next

This is the code I am using, but it is giving error (on assignments.add)
when I am saving the proect for the first time, on next save the assignment
orks fine.

Any pointers to solvethis will be helpful.

Thanks.
 
Q

question

Error: runtime error 10044; an unexpected error occured within the method.

Thanks.
 
J

Jack Dahlgren

I'd set a break point just before the line and try running it. Set a watch
for all the variables you are looking at. Then go through and see what is
happening.
You could also step through the code using the F8 key.
I think there might be something wrong with the value you are passing as
RID. I don't know how you set and validated that information so there is no
way for me to debug this here.

If you need further help you should post all the code. Otherwise it is
impossible to tell what the problem is.

-Jack Dahlgren
 

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