Skip to content

VBA 2003 to 2010

Fabian BreuMember for 14 years 11 months
Created
2
3
0

Hi

Tilll now i used the following macro to copy custom field content from the task tabelle to the assigment tabelle. So when i save the project it copy text5 from the gantt chart to text5 field in the ressource usage view.

 

This macro does not work in MS Project 2010. If i save the file als 2003 version it works more or less. It only works if delete the contant in text5 in the ressource usage and then save. So it does not perform updates.

 

I set the setting in the trust center to enable all macros.

what i wrong

Private Sub Project_BeforeSave(ByVal pj As Project)
Dim t As Task
Dim ts As Tasks
Dim A As Assignment
Set ts = ActiveProject.Tasks
For Each t In ts
    If (Not t Is Nothing) Then
        For Each A In t.Assignments
            'change the following line to use
            'for a different custom field
            A.Text5 = t.Text5
           
        Next A
    End If
Next t

End Sub

 

2 replies

Oldest first
  1. 0
    Ismet Kocaman ·

    Could you pls verify you have

    Could you pls verify you have SP1 and August Hotfix applied to Project 2010 ?

    Regards,

    Ismet

  2. 0
    Ali Deveboynu ·

    mr fabian ı just copy the

    mr fabian 

    ı just copy the text to global. mpt and it works , if you still have problems could you try to insert a new module and paste 

     

    Private Sub Project_BeforeSave()
    Dim t As Task
    Dim ts As Tasks
    Dim A As Assignment
    Set ts = ActiveProject.Tasks
    For Each t In ts
        If (Not t Is Nothing) Then
            For Each A In t.Assignments
                'change the following line to use
                'for a different custom field
                A.Text5 = t.Text5
               
            Next A
        End If
    Next t
    End Sub
     
     and run this script manually 
     
    best regards.

Log in or join to reply

ProjectControls.com is free to join. Members can post questions, reply, vote and follow discussions.

Existing members: your original username and password still work. Forgot password?