Access to "Project" field of Task

  • Thread starter Jack Dahlgren MVP
  • Start date
J

Jack Dahlgren MVP

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
 
C

Carl

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
 
C

Carl

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
 
C

Carl

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top