Hi Patrick,
If I remember correctly, I downloaded this code from the MS Project website
a l-o-n-g time ago. Anyway, you can use this to connect to the database and
extract the notes field. You will need to use VBA in MS Project to paste
the code in and run it. -Bill
Option Compare Database
Option Explicit
Sub getrtf()
Dim db As Database
Dim rs As Recordset
Dim bytBuffer() As Byte
Dim strData As String, strExtracted As String
Dim intSize As Integer, intOffset As Integer
'This macro will look for Task Notes and extract the rtf. This rtf can then
be written to a file
'that Word will understand or displayed in a richedit control.
'Open the Task_Information table to look for Task Notes
Set rs = CurrentDb.OpenRecordset("Task_Information", dbOpenTable)
'Enumerate across the recordset looking for notes
With rs
Do While Not .EOF
If !Reserved_hasnotes <> 0 Then
' Extract string
strData = StrConv(rs!Reserved_BinaryProperties, vbUnicode) ' Put binary
column data into text string
intSize = GetIntegerFromPosition(strData, 1) ' Size starts at position 1
intOffset = GetIntegerFromPosition(strData, 5) ' Offset starts at 5
strExtracted = Mid(strData, intOffset + 1, intSize)
Debug.Print strExtracted
End If
..MoveNext
Loop
..Close
End With
End Sub
Function GetIntegerFromPosition(s As String, p As Long) As Integer
Dim i As Long, intResult As Integer
For i = p + 3 To p Step -1
intResult = intResult * 255 ' Shift one byte
intResult = intResult + Asc(Mid(s, i, 1))
Next i
GetIntegerFromPosition = intResult
End Function
--
Bill Raymond
projectnation at hotmail dot com
Patrick said:
John,
I have encountered the same problem but I want to save my notes to an
Access database format so that I can create truly custom reports. I have
searched the web for ome sample VB code but have been unsuccesful. I have
very little prgramming knowledge but in the past I have been able to adapt
code to suit my needs. I adapted some VB code in MS Access to concatenate
data from multiple records.
I would like to have VB code that extracts the Text_REF_UID field and the
TEXT_VALUE field to a MS Access table. Does the use of EOL (End of Line -
Return/Enter) pose any issues?