PDA

View Full Version : MACRO TO LINK EACH RESOURCE NAME



Rob2015
08-16-2015, 10:05 AM
I'm working on a macro to link each "Resource Name" together for this Gant chart (see attachment) and have been unsuccessful. The macro only works on this same report but would like to see if there is a VBA code that could link the same "Resource Name".

SamT
08-16-2015, 03:56 PM
Let us see what code you have. Please use the # icon on the editor to put code tags around your code. The easiest way is to click the icon, then paste your code between the tags.

Rob2015
08-16-2015, 04:49 PM
Sub Macro2()
' Macro Macro2
' Macro Recorded Sun 8/16/15 by ROBERT.14193
SelectTaskField Row:=0, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=4, Column:="Resource Names", Height:=5
LinkTasks
SelectTaskField Row:=6, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=4, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=5, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=4, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=2, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=2, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=2, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=2, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=1
LinkTasks
SelectTaskField Row:=2, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=5, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=3
LinkTasks
SelectTaskField Row:=4, Column:="Resource Names", Height:=2
LinkTasks
SelectTaskField Row:=3, Column:="Resource Names", Height:=1
LinkTasks
End Sub

Rob2015
08-16-2015, 04:56 PM
What I'm trying to do is link the "same" resource name. The macro records rows and each day will be recorded different b/c each resource name does not have the same # of jobs to line up with the macro. So, I'm looking for a code that can link resources that share the same name, if that makes better sense.

SamT
08-17-2015, 09:04 AM
Rob,


While I am pretty good with all VBA code, I do not have MS Project on my Computer. I did Download the 2002 Project help file (http://www.microsoft.com/en-us/download/details.aspx?id=7584), and a brief perusal suggest that you need to work with the Resources Collection and or ResourceName Field.

For Example:
With Column:="Resouces Nzmes"
For Rw = 1 to LastRow
Resources(Row:=Rw).Assignments.Add Tasks(Taskfield Row:=Rw)
Next
End With

And Then:
For Each RN in Resources
.Assinments.Link
Next

No, that is not real code, that is why I did not format it nor correct typos. I am just trying to give you an idea. I might buy an old version of Project and see if I can't bring some life to this forum, but that can't happen until early 2016.

I am very sorry we can't be more helpful. Please subscribe to this thread so you can get Emailed notification if anybody else posts here. I am sure that somebody knows more about Project than I do.

Rob2015
08-17-2015, 07:39 PM
No problem! Will subscribe to this and thanks for your time and informational link SamT. Happy Coding :)