Examples: Color property

This agent gets the table color of the first or only table in an item.

Function GetColorString(Byval colorCode As Long) As String
  Select Case colorCode
  Case COLOR_BLACK : GetColorString = "Black"
  Case COLOR_BLUE : GetColorString = "Blue"
  Case COLOR_CYAN : GetColorString = "Cyan"
  Case COLOR_DARK_BLUE : GetColorString = "Dark blue"
  Case COLOR_DARK_CYAN : GetColorString = "Dark cyan"
  Case COLOR_DARK_GREEN : GetColorString = "Green"
  Case COLOR_DARK_MAGENTA : GetColorString = "Magenta"
  Case COLOR_DARK_RED : GetColorString = "Red"
  Case COLOR_DARK_YELLOW : GetColorString = "Yellow"
  Case COLOR_GRAY : GetColorString = "Gray"
  Case COLOR_GREEN : GetColorString = "Green"
  Case COLOR_LIGHT_GRAY : GetColorString = "Light gray"
  Case COLOR_MAGENTA : GetColorString = "Magenta"
  Case COLOR_RED : GetColorString = "Red"
  Case COLOR_WHITE : GetColorString = "White"
  Case COLOR_YELLOW : GetColorString = "Yellow"
  Case Else : GetColorString = Cstr(colorCode)
  End Select
End Function

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim dc As NotesDocumentCollection
  Set dc = db.UnprocessedDocuments
  Dim doc As NotesDocument
  Set doc = dc.GetFirstDocument
  Dim rti As NotesRichTextItem
  Set rti = doc.GetFirstItem("Body")
  Dim rtnav As NotesRichTextNavigator
  Set rtnav = rti.CreateNavigator
  If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
    Messagebox "Body item does not contain a table,",, "Error"
    Exit Sub
  End If
  Dim rtt As NotesRichTextTable
  Set rtt = rtnav.GetElement
  colorString$ = GetColorString(rtt.Color.NotesColor)
  Messagebox "Color = " & colorString$,, "NotesRichTextTable"
End Sub