none
Invalid argument value RRS feed

  • Question

  • This is probably a very elementary question, but I am trying to run a macro in Project Professional 2007 that simply changes the value in the Assignment Owner column to [Project Owner].  I recorded the macro.  But when I rerun it I get "The argument value is not valid" error.  How do I change the code to make this work? 

    Sub Macro1()
    ' Macro Macro1
     Macro Recorded 

        SetTaskField Field:="Assignment Owner", Value:="[Project Owner]"
        SelectResourceField Row:=6, Column:="Assignment Owner", RowRelative:=False
        SelectResourceField Row:=3, Column:="Assignment Owner", RowRelative:=False
        SelectResourceField Row:=3, Column:="Assignment Owner", RowRelative:=False, Height:=37
        FillDown
    End Sub

    Tuesday, October 19, 2010 4:41 PM

All replies

  • This is probably a very elementary question, but I am trying to run a macro in Project Professional 2007 that simply changes the value in the Assignment Owner column to [Project Owner].  I recorded the macro.  But when I rerun it I get "The argument value is not valid" error.  How do I change the code to make this work? 

    Sub Macro1()
    ' Macro Macro1
     Macro Recorded 

        SetTaskField Field:="Assignment Owner", Value:="[Project Owner]"
        SelectResourceField Row:=6, Column:="Assignment Owner", RowRelative:=False
        SelectResourceField Row:=3, Column:="Assignment Owner", RowRelative:=False
        SelectResourceField Row:=3, Column:="Assignment Owner", RowRelative:=False, Height:=37
        FillDown
    End Sub

    It is choking on the "[Project Owner]" value. The quotations mark that as a string so you are trying to literally set it to the name [Project Owner] which is someone unlikely to be in the resource pool.

    The difficulty with doing this is that there is within Project Pro there is no field for "Project Owner" The closest thing is the status manager. Status manager would be whoever last published the assignmnet.

    So if you want to set all the assignment owners to that person you could do something like this:

    Sub setassignmentownertoprojectowner()
    Dim r As Resource
    Dim a As Assignment
    For Each Resource In ActiveProject.Resources
    For Each a In r.Assignments
    a.Owner = a.Task.StatusManagerName
    Next a
    Next r
    End Sub

    I've not tested this on a real project as I don't have 2007 available to test on, but it should be close to what you need.

     


     


    Jack Dahlgren blogs at:
    Project and Retrovention
    and rarely Twitter
    Tuesday, October 19, 2010 6:15 PM
    Moderator
  • The problem is when the original person publishes a project and later it is assigned to another person to take over.  We then change the project owner to the new person.  However the task status updates are still linked to the first person.  Is there a better way to handle this?  We thought if we could set up all projects so the assignment owner was the [project owner] then all would transfer when needed.

    Tuesday, October 19, 2010 7:13 PM
  • The problem is when the original person publishes a project and later it is assigned to another person to take over.  We then change the project owner to the new person.  However the task status updates are still linked to the first person.  Is there a better way to handle this?  We thought if we could set up all projects so the assignment owner was the [project owner] then all would transfer when needed.

     

    Does anyone have a solution to this?

    Thursday, October 21, 2010 5:13 PM
  • Hi,

    first of all: If I understand your post from Tuesday, October 19, 2010 7:13 PM correctly, you don't want to change assignment owner, but status manager ;-).

    Assignment Owner is the person who can see task in "My Tasks" view and will update progress. In most cases resource= assignment owner. But you can define a different default assignment ower for resources. And you can change assignment owner on assignment level, to move responsibilty for updateing progress.

    Status Manager is defined on task level. This person has to approve (or reject) task updates. Default, it is the project owner when creating a project. For new task it is the logged in user. And as you write, Status Manager is not updated be changing the owner.

    Unfortunately I never found a possibility within VBA to get the owner. You can get owner's name connecting to Reporting DB or using PSI.
    If your new owner is no status manager of any task so far, he will be the only person who is allowed to change Status Manager Field to his name (and to run your macro). Since he should know his own name, you could let him enter the name for running your macro.

    So someting like that should work:

    Sub setstatusmanagertoprojectowner()
    Dim T As Task
    StatusMGR = InputBox("Your name in resource notation:")
    For Each T In ActiveProject.Tasks
        If Not T Is Nothing And Not T.Summary Then
            T.StatusManagerName = StatusMGR
        End If
    Next
    End Sub

    Another possibilty: Let your macro add a task, read status manager of this task, keep the name, delete this task and change all status manager fields to this name.

    Does that help?
    Barbara

    Friday, October 22, 2010 5:40 AM
    Moderator
  • We were hoping we could set the field to the generic [project owner] value at the time the project was published.  That way if/when a new manager was assigned it would transfer automatically to the newly named project owner.  If that is not possible, we will probably have to use your method.  Thanks for the help.

    Friday, October 22, 2010 12:22 PM