PDA

View Full Version : MS Project Pro 2016 Macro Help



meesh99
11-13-2019, 08:57 AM
I'm quite new to VBA and am struggling to write a macro that will copy data from a custom Resource field to a custom Task field. Specifically, I want TaskField.Number13 to equal ResourceField.Number1 based on the Resource Name assigned to a task.

This is what I have so far...


Sub CopyResourceSkillLevel()
' Copy Resource Skill Level from Resource Sheet to Task Sheet
Dim res As Resource
For Each res In ActiveProject.Resources
For Each asn In res.Assignments
ResourceField.Number1
Next asn
Next res
' transfer data to show in the Task Usage view
Dim tsk As Task
For Each tsk In ActiveProject.Tasks
For Each asn In tsk.TaskField
' use only ONE of the following:
' to show the task's value use
' asn.Text2 = tsk.Text2
' to show the resource's value use
res.ResourceField.Name = tsk.TaskField = "Resource Names"
tsk.TaskField.Number13 = res.ResourceField.Number1
Next asn
Next tsk
End Sub

Any suggestions on how to achieve what I'm trying to do? I'm really hoping to not have to do it manually for each task.