参数值无效 [英] Invalid argument value
问题描述
这可能是一个非常基本的问题,但我试图在Project Professional 2007中运行一个宏,只需将"分配所有者"列中的值更改为[项目所有者]。 我录制了宏。 但是当我重新运行它时,我得到"参数
值无效"。错误群组。如何更改代码才能使其正常工作?
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()
'微距Macro1
微距已录制
Sub Macro1()
' Macro Macro1
Macro Recorded
SetTaskField字段:="分配所有者",值:=" [项目所有者]"
$
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
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
推荐答案
这可能是一个非常基本的问题,但我试图在Project Professional 2007中运行一个宏,只需将"分配所有者"列中的值更改为[项目所有者]。 我录制了宏。 但是当我重新运行它时,我得到"参数
值无效"。错误群组。如何更改代码才能使其正常工作?
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()
'微距Macro1
微距已录制
Sub Macro1()
' Macro Macro1
Macro Recorded
SetTaskField字段:="分配所有者",值:=" [项目所有者]"
$
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
结束子
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.
执行此操作的难点在于Project Pro中没有"项目所有者"字段。最接近的是状态管理器。状态管理员将是最后发布assignmnet的人。
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
每个资源在ActiveProject.Resources中
For each a in r.Assignments
a.Owner = a.Task.StatusManagerName
Next a $
Next r
End Sub
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
我没有在真实项目上测试过这个,因为我没有2007可用于测试,但它应该接近你需要的。
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.
这篇关于参数值无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!