Extract MSProject 2K Notes to Text File

P

Phil

This VBA code extracts Task UID, ID, Outline Level, Name and Notes
from a MSP 2K file and places them in a text file.

Public Sub PrintTasks()
' Creates/Overwrites a text file in the same dir as the MSP file using
the same
' name with " Notes.txt" appended. For each task that contains a
Note, the
' Task UID, ID, Outline Level and Name are placed on the first line
and the
' Task Notes, with Notes starting on a new line headed by a newline
character
' (hex 0D). Placed on second and subsequent lines.
' Notepad does not properly render a newline character by itself,
WordPad does.
'
' All tasks are made visible when this code is run.
' ----------------------------
' Phil Bornemeier 06 Sep 2003
' ----------------------------

Dim fs As Variant
Dim a As Variant

OutlineShowAllTasks

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(ActiveProject.FullName & " Notes.txt", True)
a.write "AAAAA BBBBB CCC DDDDD..." & Chr(13) & Chr(10)
a.write "Tasks" & Chr(13) & Chr(10)
a.write "Where A = Unique ID; B = ID; C = Outline Level; " & _
"D = Task Name" & Chr(13) & Chr(10)
a.write Chr(13) & Chr(10)

Dim t As Task
For Each t In ActiveProject.Tasks
EditGoTo t.ID: SelectRow
If Len(t.Notes) > 0 Then
a.write Right(" " & t.uniqueId, 5) & " " & _
Right(" " & t.ID, 5) & " " & _
Right(" " & t.OutlineLevel, 3) & " " & _
t.Name & Chr(13) & Chr(10)
a.write t.Notes & Chr(13) & Chr(10)
a.write Chr(13) & Chr(10)
End If

Next

a.Close
Set t = Nothing
Set a = Nothing

End Sub
 

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