Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
other
informationbridge
office.intranets
office.misc
office.setup
office.xml
officeupdate
onenote
photodraw.discussion
powerpoint
producer
proj.standard&server
project
project.developer
project.pro_and_serve
project.server
project.vba
project2000
publisher
publisher.prepress
publisher.programming
publisher.webdesign
visio
visio.createshapes
visio.database.modeling
visio.dev.diagrams
visio.dev.shapesheet
visio.dev.vba
visio.dev.vc
visio.developer
visio.general
visio.installation
visio.printing
visio.software.modeling
visio.troubleshoot
  
 
date: Fri, 3 Oct 2008 08:13:01 -0700,    group: microsoft.public.project.developer        back       


Access to "Project" field of Task   
I'm using Project 2000 and want to loop through the tasks, printing out the 
contents of the "Project" field.  Here's a code snippet:

    Sub LoopTasks()
     Dim Tsk As Task
      For Each Tsk In ActiveProject.Tasks
        If Not Tsk Is Nothing Then ' test for blank rows
          Debug.Print Tsk.Project
        End If
      Next Tsk
    End Sub

This prints the name of the .mpp file, not the value of the task's "Project" 
field.  What do I need to do to print the contents of the "Project" field?

    -- Carl
date: Fri, 3 Oct 2008 08:13:01 -0700   author:   Carl

RE: Access to "Project" field of Task   
Figured out the problem.  I inherited a project with a custom Text1 field 
named "Project".  Changed the "Project" reference to "Text1" and I'm getting 
what I was looking for.

    -- Carl

"Carl" wrote:

> I'm using Project 2000 and want to loop through the tasks, printing out the 
> contents of the "Project" field.  Here's a code snippet:
> 
>     Sub LoopTasks()
>      Dim Tsk As Task
>       For Each Tsk In ActiveProject.Tasks
>         If Not Tsk Is Nothing Then ' test for blank rows
>           Debug.Print Tsk.Project
>         End If
>       Next Tsk
>     End Sub
> 
> This prints the name of the .mpp file, not the value of the task's "Project" 
> field.  What do I need to do to print the contents of the "Project" field?
> 
>     -- Carl
date: Fri, 3 Oct 2008 08:34:10 -0700   author:   Carl

Re: Access to "Project" field of Task   
If Not Tsk Is Nothing Then ' test for blank rows
>          Debug.Print Tsk.Project
>        End If

How about
if not Tsk.External then
Debug.Print Activeproject.Name
end if

Finding the name of the project if it is a sub-project requires opening that 
project (using the path that you found in your code) and getting that 
project's name

If you don't want to do that, then you can use some string functions to 
strip out everything before the / and everything from the . onward
left(tsk.project,instr(tsk.project, ".")) or something like that will strip 
out the .mpp. You would do the same with the / which separates the path from 
the project name.

-Jack Dahlgren

"Carl"  wrote in message 
news:CC965672-E9F2-41E4-B071-22CA83B40A9F@microsoft.com...
> I'm using Project 2000 and want to loop through the tasks, printing out 
> the
> contents of the "Project" field.  Here's a code snippet:
>
>    Sub LoopTasks()
>     Dim Tsk As Task
>      For Each Tsk In ActiveProject.Tasks
>        If Not Tsk Is Nothing Then ' test for blank rows
>          Debug.Print Tsk.Project
>        End If
>      Next Tsk
>    End Sub
>
> This prints the name of the .mpp file, not the value of the task's 
> "Project"
> field.  What do I need to do to print the contents of the "Project" field?
>
>    -- Carl
date: Fri, 3 Oct 2008 08:41:52 -0400   author:   Jack Dahlgren MVP

Re: Access to "Project" field of Task   
Jack,

Thanks for your response.  Turns out this was pilot error on my part, I 
didn't realize that the column labeled "Project" was actually "Text1".  Once 
I figured that out I was able to move on and bump my head on the next 
stumbling block.

    -- Carl

"Jack Dahlgren MVP" wrote:

>  If Not Tsk Is Nothing Then ' test for blank rows
> >          Debug.Print Tsk.Project
> >        End If
> 
> How about
> if not Tsk.External then
> Debug.Print Activeproject.Name
> end if
> 
> Finding the name of the project if it is a sub-project requires opening that 
> project (using the path that you found in your code) and getting that 
> project's name
> 
> If you don't want to do that, then you can use some string functions to 
> strip out everything before the / and everything from the . onward
> left(tsk.project,instr(tsk.project, ".")) or something like that will strip 
> out the .mpp. You would do the same with the / which separates the path from 
> the project name.
> 
> -Jack Dahlgren
> 
> "Carl"  wrote in message 
> news:CC965672-E9F2-41E4-B071-22CA83B40A9F@microsoft.com...
> > I'm using Project 2000 and want to loop through the tasks, printing out 
> > the
> > contents of the "Project" field.  Here's a code snippet:
> >
> >    Sub LoopTasks()
> >     Dim Tsk As Task
> >      For Each Tsk In ActiveProject.Tasks
> >        If Not Tsk Is Nothing Then ' test for blank rows
> >          Debug.Print Tsk.Project
> >        End If
> >      Next Tsk
> >    End Sub
> >
> > This prints the name of the .mpp file, not the value of the task's 
> > "Project"
> > field.  What do I need to do to print the contents of the "Project" field?
> >
> >    -- Carl 
>
date: Fri, 3 Oct 2008 13:22:01 -0700   author:   Carl

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us