Hi ,
I am trying to do a macro who read my email and especially the first Table of the body of my lotus notes email .
My Macro is based on the lotus documentation : Lotus Domino Designer 7 Help - LotusScript Classes A-Z
and especially this example who explain how to read a table Lotus Domino Designer 7 Help - Examples: NotesRichTextTable class
Here is my macro :
I have got an error at the line "Set rti = NDoc.GetFirstItem("Body")" (Error 13 Incompatibility of type). I don't understant why the content of the email cannot be consider as a "Rich text" but only as a simple text . When i read the documentation the content of an email is supposed to be "rich text" . Is there a way to convert from simple text to rich text ?
Thanks for your help,
I am trying to do a macro who read my email and especially the first Table of the body of my lotus notes email .
My Macro is based on the lotus documentation : Lotus Domino Designer 7 Help - LotusScript Classes A-Z
and especially this example who explain how to read a table Lotus Domino Designer 7 Help - Examples: NotesRichTextTable class
Here is my macro :
Code:
Public Sub Get_Notes_Email_Text()
Dim NSession As Object 'NotesSession
Dim NMailDb As Object 'NotesDatabase
Dim NDocs As Object 'NotesDocumentCollection
Dim NDoc As Object 'NotesDocument
Dim NNextDoc As Object 'NotesDocument
'Dim NItem As Object 'NotesItem
Dim view As String
Dim filterText As String
view = "$All" 'Name of view or folder to retrieve documents from
filterText = "test" 'Optional text string to filter the view
Set NSession = CreateObject("Notes.NotesSession")
Set NMailDb = NSession.GETDATABASE("", "") 'Default server and database
If Not NMailDb.IsOpen Then
NMailDb.OPENMAIL
End If
Set NDocs = NMailDb.GETVIEW(view)
NDocs.Clear
If filterText <> "" Then
NDocs.FTSEARCH filterText, 0
End If
Set NDoc = NDocs.GETFIRSTDOCUMENT
Do Until NDoc Is Nothing
Set NNextDoc = NDocs.GETNEXTDOCUMENT(NDoc)
Dim rti As NotesRichTextItem
Set rti = NDoc.GetFirstItem("Body")
If Not rti Is Nothing Then
Dim rtnav As NotesRichTextNavigator
Set rtnav = rti.CreateNavigator
If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
MsgBox "Body item does not contain a table,", , _
"Error"
Exit Sub
End If
Dim rtt As NotesRichTextTable
Set rtt = rtnav.GetElement
Dim rtrange As NotesRichTextRange
Set rtrange = rti.CreateRange
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
firstFlag = True
For i& = 1 To rtt.RowCount
For j& = 1 To rtt.ColumnCount
If Not firstFlag Then
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Else
firstFlag = False
End If
Call rtrange.SetBegin(rtnav)
MsgBox rtrange.TextParagraph, , _
"Row " & i& & _
", Column " & j&
Next
Next
End If
Set NDoc = NNextDoc
Loop
End Sub
I have got an error at the line "Set rti = NDoc.GetFirstItem("Body")" (Error 13 Incompatibility of type). I don't understant why the content of the email cannot be consider as a "Rich text" but only as a simple text . When i read the documentation the content of an email is supposed to be "rich text" . Is there a way to convert from simple text to rich text ?
Thanks for your help,