How do I access the valve of the Project Owner and custom enterprise fields of a project in Project Server 2007 from MS Project Pro VBA? Gary
Hi, In Project Pro 2007 use: activecell.task.getfield(application.fieldnametofieldconstant("Field Name",pjTask)) This is from memory, so clearly I need a new life and there are no guarantees this code will work as is!! -- Rod Gill Microsoft MVP for Project Author of the only book on Project VBA, see: http://www.projectvbabook.com "Gary Zag" wrote in message news:8C4F0D6E-D6E0-4775-B37F-2B9087000251@microsoft.com... > How do I access the valve of the Project Owner and custom enterprise > fields > of a project in Project Server 2007 from MS Project Pro VBA? > > Gary
Ron, Thanks that works for the custom fields. Anyone know how to get the value of Project Owner from VBA? Gary "Rod Gill" wrote: > Hi, > > In Project Pro 2007 use: > > activecell.task.getfield(application.fieldnametofieldconstant("Field > Name",pjTask)) > > This is from memory, so clearly I need a new life and there are no > guarantees this code will work as is!! > -- > > Rod Gill > Microsoft MVP for Project > > Author of the only book on Project VBA, see: > http://www.projectvbabook.com > > > > "Gary Zag" wrote in message > news:8C4F0D6E-D6E0-4775-B37F-2B9087000251@microsoft.com... > > How do I access the valve of the Project Owner and custom enterprise > > fields > > of a project in Project Server 2007 from MS Project Pro VBA? > > > > Gary > >
Function GetOwner(p As Project) As String On Error Resume Next GetOwner = p.CustomDocumentProperties("Owner") If Err Then ' 5 on fail Err.Clear GetOwner = "" End If On Error GoTo 0 End Function "Gary Zag" wrote in message news:24150303-83CF-4011-B649-C6CFFEB93455@microsoft.com... > Ron, > > Thanks that works for the custom fields. Anyone know how to get the value > of Project Owner from VBA? > > Gary > > "Rod Gill" wrote: > >> Hi, >> >> In Project Pro 2007 use: >> >> activecell.task.getfield(application.fieldnametofieldconstant("Field >> Name",pjTask)) >> >> This is from memory, so clearly I need a new life and there are no >> guarantees this code will work as is!! >> -- >> >> Rod Gill >> Microsoft MVP for Project >> >> Author of the only book on Project VBA, see: >> http://www.projectvbabook.com >> >> >> >> "Gary Zag" wrote in message >> news:8C4F0D6E-D6E0-4775-B37F-2B9087000251@microsoft.com... >> > How do I access the valve of the Project Owner and custom enterprise >> > fields >> > of a project in Project Server 2007 from MS Project Pro VBA? >> > >> > Gary >> >>
Bill, This does not work. It produces an error. The CustomDocumentProperties collection does not have a element with the Name of "Owner". Gary "Bill B" wrote: > Function GetOwner(p As Project) As String > On Error Resume Next > GetOwner = p.CustomDocumentProperties("Owner") > If Err Then ' 5 on fail > Err.Clear > GetOwner = "" > End If > On Error GoTo 0 > End Function > > > "Gary Zag" wrote in message > news:24150303-83CF-4011-B649-C6CFFEB93455@microsoft.com... > > Ron, > > > > Thanks that works for the custom fields. Anyone know how to get the value > > of Project Owner from VBA? > > > > Gary > > > > "Rod Gill" wrote: > > > >> Hi, > >> > >> In Project Pro 2007 use: > >> > >> activecell.task.getfield(application.fieldnametofieldconstant("Field > >> Name",pjTask)) > >> > >> This is from memory, so clearly I need a new life and there are no > >> guarantees this code will work as is!! > >> -- > >> > >> Rod Gill > >> Microsoft MVP for Project > >> > >> Author of the only book on Project VBA, see: > >> http://www.projectvbabook.com > >> > >> > >> > >> "Gary Zag" wrote in message > >> news:8C4F0D6E-D6E0-4775-B37F-2B9087000251@microsoft.com... > >> > How do I access the valve of the Project Owner and custom enterprise > >> > fields > >> > of a project in Project Server 2007 from MS Project Pro VBA? > >> > > >> > Gary > >> > >> > > >