none
MS Project auto-create Resource Engagement RRS feed

  • Question

  • Hi,

    I am wondering if it is possible to automatically create Resource Engagements based on the the aggregated work. Currently we have to create the engagement manually (1) and copy-paste the aggregated work to the proposed work row (2). It would be great if these actions can be automated via a macro or so.

    Suggestions are appreciated.

    Sander Bots

    Wednesday, March 22, 2017 8:18 PM

Answers

  • Sander --

    I just looked at the VBA Object Browser in Microsoft Project 2016, and it appears all of the required elements are available to create Resource Engagements using the Project VBA programming language.  However, I can tell you that it would be a lot of work to create a macro to automatically create Resource Engagements!  If you have the VBA programming skills, go for it, my friend.  Hope this helps.


    Dale A. Howard [MVP]

    Wednesday, March 22, 2017 8:50 PM
    Moderator

All replies

  • Sander --

    I just looked at the VBA Object Browser in Microsoft Project 2016, and it appears all of the required elements are available to create Resource Engagements using the Project VBA programming language.  However, I can tell you that it would be a lot of work to create a macro to automatically create Resource Engagements!  If you have the VBA programming skills, go for it, my friend.  Hope this helps.


    Dale A. Howard [MVP]

    Wednesday, March 22, 2017 8:50 PM
    Moderator
  • Hi Sander,

    Did you find any solution? creating the Engagement is a very simple one

    Set MyEng = ActiveProject.Engagements.Add(resourceid, dStart, dEnd, value)

    The problem is in editing the TimeScaledData (or TimephasedDataSet) of the engagement, there is really nothing on the Net about this, or at least I could not find any, yet.

    In Dutch 'een hopeloze zaak' ;-)

    Thursday, June 1, 2017 1:44 PM
  • Thanks guys, I was more hoping for out of the box functionality. I will investigate the macro options when necessary.

    Thursday, July 6, 2017 11:04 AM
  • I've created this macro to create engagements from tasks:

                                                                  

    Sub create_engagements_for_selected_tasks()
    ' Macro create_engagement
    ' Macro Written Fri 29-09-17 by Kraijenoord; A.C. (ICT).
       
        Dim selTasks As Tasks
        Set selTasks = ActiveSelection.Tasks
        'Debug.Print selTasks.Count
        
        Dim curTask As Task
        Dim curResource As Resource
        Dim curAssignment As Assignment
        
        Dim strComment As String
        Dim intEngResourceID As Integer
        
        strComment = "vul maar in"
        strComment = InputBox("Geef het commentaar bij deze aanvraag", "Opmerking", strComment)
        
        
        For Each curTask In selTasks
            For Each curAssignment In curTask.Assignments
                Set curResource = curAssignment.Resource
                Dim objNewEngagement As Engagement
                ' Find the resource ID for this team member
                'Debug.Print "Eng Resource ID: " & curResource.GetField(pjResourceID)
                intEngResourceID = 0
                intEngResourceID = curResource.GetField(pjResourceID)
                
                Debug.Print "In create_engagements_for_selected_tasks: " & curResource.UniqueID & ": " & intEngResourceID & ": " & curResource.Name & ": " & curAssignment.Start & ": " & curAssignment.Finish & ": " & curAssignment.Work
                
                ' Create the engagement
                Set objNewEngagement = ActiveProject.Engagements.Add(intEngResourceID, curAssignment.Start, curAssignment.Finish, curAssignment.Work)
                ' Set the comments
                objNewEngagement.Comments.Add (strComment)
                Set objNewEngagement = Nothing
            Next
        Next
            
        ViewApply Name:="&Gantt-diagram"
        ViewApplyEx Name:="Resource Form", ApplyTo:=1
        DetailsPaneToggle
        ViewApply Name:="Resource Plan"

        

    End Sub


    • Edited by AlexanderKr79 Monday, October 2, 2017 6:23 AM there was a bug in the orginal post, that is now fixed
    • Proposed as answer by AlexanderKr79 Monday, October 2, 2017 6:24 AM
    Friday, September 29, 2017 8:05 AM
  • Hello,

    thank you for your help. Is there a vba method to submit the engagement ? I don't find it in the documentation...

    zigune

    Friday, October 11, 2019 7:34 PM
  • Hello,

    thank you for your help. Is there a vba method to submit the engagement ? I don't find it in the documentation...

    zigune

    Hello,

    for the people wondering. See the answer here :

    https://social.technet.microsoft.com/Forums/office/en-US/7f4c2439-ab7b-400d-8236-fd1d325ef55a/how-to-submit-an-engagement-in-vba-?forum=projectonline

    zigune


    Monday, October 14, 2019 6:48 AM