Share via

MS Project run-time error

Anonymous
2013-07-10T12:40:34+00:00

Hello,

I'm trying to use a VBA macro to paste the content of a summary task custom field into child tasks. When I run the macro, I receive run-time error 1001 "Application or object defined error". The code I am using is the following:

Sub FilterGroup()

For Each Task In ActiveProject.Tasks

If Not Task Is Nothing Then

If Not Task.Summary Then

 Task.GroupNumber = Task.OutlineParent.GroupNumber

End If

End If

Next Task

End Sub

Could you please advise me on what could be wrong?

Thanks a lot and regards,

Julia

Microsoft 365 and Office
Microsoft 365 and Office

A comprehensive suite of productivity tools and cloud services that enhance collaboration, communication, and efficiency. Combining classic Office apps with advanced Microsoft 365 features, it supports both personal and business needs

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2013-07-15T18:19:46+00:00

    Hello,

    Thank you for the assistance - I will try your suggestions and will write back.

    Regards,

    Julia

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-07-11T10:09:22+00:00

    Hi,

    When asking qustions, even about ProjectProdfessional, it is better to always indicate if you are connected to Server - that namely changes some "rules".

    For instance;, Enterprise custoom fields do not have a corresponding custom field in Professional so in VBA you have to address them differently.

    So this could be a working sequence:

    FN=Fieldnametofieldconstant("Group Number")

    OPGN=T.outlineparent.getfield(FN)

    T.setfield(FN,OPGN)

    Greetings,

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-07-11T10:06:58+00:00

    Hi Julia,

    The fact that it is an Enterprise Custom field does change things.  I do not use server, but I do recall seeing information about the GetField method for enterprise fields.  Sadly, I cannot go much further than to suggest you start with the post below from the MSDN Project Customization forum. 

    http://social.technet.microsoft.com/Forums/projectserver/en-US/4124c40b-e1bd-47ea-ae73-b79f88375776/returning-project-server-enterprise-custom-field-values-in-ms-project-2010-vba

    I also invite you to post to that forum http://social.technet.microsoft.com/Forums/projectserver/en-US/home?forum=project2010custprog

    Sorry I cannot be of more help.

    Julie

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-07-10T21:22:33+00:00

    Hello Julie,

    Thanks for the quick reply.

    Yes, GroupNumer is an enterprise text field. The issue is that I can't figure out which exact text field GroupNumber maps to.

    I tested to create a local custom field and the formula works when I use Text1 instead of the local custom field. However, in PWA I cannot see what text fields the enterprise custom fields use, so I don't really know which Text field to use.

    It would be of great help if you could help me figure it out.

    Thanks a lot and Regards,

    Julia

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-07-10T15:41:39+00:00

    Julia,

    I am by no means a VBA expert - but is "GroupNumber" a renamed custom field?  What happens if you use the real name of the field?  I was able to get your code to work by using Task.Number10

    Julie

    Was this answer helpful?

    0 comments No comments