I realize this may seem like a silly question, but if the field Attachment is rich text, can someone possibly tell me what the following script should do?
Sub Click(Source As Button)
Dim doca As NotesDocument
Dim rtitem As NotesRichTextItem
Set rtitem = doca.GetFirstItem("Attachment")
If ( rtitem.Type = RICHTEXT ) Then
Messagebox("This is a rich text field.")
End If
Assuming that doca was properly instantiated, you would get a pop up message saying that it is a rich text field. Does your question derive from the examples that give in Designer help? The examples they give assume that you may be cycling through all items and not know the type of field. If you want to use NotesRichTextItem class properties and methods, you would first test the item type before doing so.
I expect it to error out (Object variable not set) because though you declared doca, you didn’t assign it a value.
If you assigned doca to the current document, if it’s a new document, you will get the same error because rich text fields are not normally populated into the back end until the document is saved. If you use NotesUIDocument.Refresh(True), then you should see the message “This is a rich text field.”
Thanks…now I guess I need more help. What do I need to do to instantiate it? It’s been a long while since I worked on this, and I’m driving myself nuts trying to figure out what I’m missing!