Assigning resourses from a resourse pool

S

Sean Bartleet

Hi,

I originally posted this to microsoft.public.project.vba but read that it is
being phased out so have reposted it here.

I have a project with many tasks. Mostly the same people perform these task.
When I assign recourses (people) from a common resource pool to each task I
have to select each resource individually from the pool for each task. As
such 10 tasks and 5 people for each means that I have to select 50 names
which is time consuming.

I tried to record a macro but nothing is recorded. Does anyone know the
syntax to assign a resource to a task?

Ideally I would like to take the task names, recourses and hours from a
spreadsheet but I think that that will be too much to ask. Just in case: For
example Tasks in cells A2 to A11, Recourses in Cells B1 to F1, hours for
each resource for each task in range B2:F11.

Any assistance will be appreciated.

Regards.

Sean
 
J

Jan De Messemaeker

AND you posted it in .project, where I replied
The assign resources window solves that.
HTH
 
J

John

Sean Bartleet said:
Hi,

I originally posted this to microsoft.public.project.vba but read that it is
being phased out so have reposted it here.

I have a project with many tasks. Mostly the same people perform these task.
When I assign recourses (people) from a common resource pool to each task I
have to select each resource individually from the pool for each task. As
such 10 tasks and 5 people for each means that I have to select 50 names
which is time consuming.

I tried to record a macro but nothing is recorded. Does anyone know the
syntax to assign a resource to a task?

Ideally I would like to take the task names, recourses and hours from a
spreadsheet but I think that that will be too much to ask. Just in case: For
example Tasks in cells A2 to A11, Recourses in Cells B1 to F1, hours for
each resource for each task in range B2:F11.

Any assistance will be appreciated.

Regards.

Sean

Sean,
Well it is certainly possible to do what you want whether the resources
(not recourses) are set up in a separate Project based master resource
pool or whether they are on an Excel spreadsheet. However the fact that
you tried recording a macro tells me you probably don't have a lot of
experience with VBA and doing what you want probably can't be done with
a simple recorded macro.

To answer your basic question, the VBA syntax for assigning a resource
to a task is: (Note: the code will generate an error if you try to make
a duplicate assignment.)
ActiveProject.Tasks(x).Assignments.Add ResourceID:=y
x = task index number (ID)
y = resource index number (ID)

If the resource pool is associated with an Excel spreadsheet, there are
two ways to make the assignments. One is to use an import map which
basically maps Excel Worksheet cells to appropriate Project fields. You
can read more about how to do that in the Project Help file. The second
method is to use VBA to pull the data from Excel and make the
assignments in Project. I suggest you try the import map method first.

Hope this helps.
John
Project MVP
 
S

Sean Bartleet

Hi,

Thanks for the code, it worked OK.

I do not seem able to get the mapping to work where my recourses are in a
row and not in a column.

I appreciate the assistance.

Sean

PS. I often find recording a macro an easy way to get the syntax. No
experience in Project but some in Excel and AutoCAD.
 
J

John

Sean Bartleet said:
Hi,

Thanks for the code, it worked OK.

I do not seem able to get the mapping to work where my recourses are in a
row and not in a column.

I appreciate the assistance.

Sean


Sean,
It doesn't work because you are trying to use those recourses again :)
Sorry, I have a thing about proofreading.

Export and Import maps are based on mapping fields of one application to
fields of another. In most applications (e.g. Project, Excel, Access,
etc.) fields are shown as columns. Therefore the import map is
structured for column (field) mapping. Rows become the data in those
columns.

If your resources are arranged in Excel by rows, they will not map
directly. I suggest you re-organize the data or, it may be possible to
create a Pivot table in Excel and then map to that, but I don't use
Pivot tables so I can't give you any more help with that.

Hope this helps.
John
Project MVP
 
Top