Stupid stupid question

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

End Sub

Subject: Stupid stupid question…

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.

Subject: RE: Stupid stupid question…

Y’know…I just realized that I instantiated doc, not doca, and doc is what I wanted to use. Thanks for your help nonetheless.

Subject: RE: Stupid stupid question…

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.”

Subject: RE: Stupid stupid question…

Andre,

Could you please look at the following:

http://www-10.lotus.com/ldd/eiforum.nsf/DateAllThreadedweb/6fc22c465ef7eeba85256f0400768fb5?OpenDocument

You are deeply missed in the EI Forum.

Subject: *Pop up a message box with “This is a rich text field.” in it.

Subject: Stupid stupid question…

Throw an error message. doca is never instantiated.

Subject: RE: Stupid stupid question…

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!

Subject: RE: Stupid stupid question…

Depends. What document or documents do you want to examine? The one currently open? A document in a view? Something else?