VBA 2003 to 2010

F
Fabian Breu 👤 Member for 14 years 9 months

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

 

A
ali deveboynu 👤 Member for 16 years 4 months

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.
I
Ismet Kocaman 👤 Member for 16 years 4 months

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

Regards,

Ismet

Featured Partner

Top Posters

Zine Eddine
2 posts
Alex Lyaschenko
27 posts
mxsiegel
0 posts
Mattvtek
0 posts
Gareth Evans
3 posts
PP Admin
3, 129 posts
Rajkamal Tangirala
5 posts
Rahul Kumar
1 posts
blake333_
0 posts
Jeamiell Ostrovsky
2 posts