Adding resources to a task in VBA

E

espenalb

Hi guys.

I am trying to extend MSPRoject2007 with a VBA macro.
I need to work with the Task.Resources.Collection

From the doc, I see that Task.Resources has a .Add method:
Function Add([Name], [Before]) As Resource

However, when I call the following code, the task.Resources.Count
remains 0:

Dim resource As resource
Set resource = task.Resources.Add("NameOfResource")

I can see that the "resource" returned has the name "NameOfResource",
but nothing happens to the task.Resources.Count...

BTW: I am running this on a project file that is connected to MSPRoject
Server 2007. I have not tried this code on a project file that is not
connected to project server.
 
J

Jan De Messemaeker

Hi,

I didn't even know the task.respources collection had an add method, I only
use it in read mode.
Try Task.Assignmens.add, that is what you do, add an assignment, not a
resource.
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
M

Mike Glen

Hi espenalb,

Try posting on the developer newsgroup as this one is closing down. Please
see FAQ Item: 24. Project Newsgroups. FAQs, companion products and other
useful Project information can be seen at this web
address:http://project.mvps.org/faqs.htm .

Mike Glen
Project MVP
 

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