Set body = doc.GetFirstItem(“Body”)Forall attach In body.EmbeddedObjects
Why is the second line above giving me a type mismatch whenever the document contains a document link only. If the document has an attachment and link, or attachment only, or no link or attachment no error is generated.
I have declared attach as NotesEmbeddedObject or Variant and same error
I do not believe that a native Notes doc link is considered an embedded object. (As a matter of fact, the Help documentation states that it is a rich text element accessible from a NotesRichTextNavigator.
I wonder if you are getting a type mismatch based off the body variable and not on the attach variable. How is the body variable dimmed–as a NotesRichTextItem or a variant?
That’s what I figured…you are going to have to test your body variable to make sure you have a NotesRichTextItem…otherwise, you are going to see behavior like this.
Try adding this line after setting the body variable:
If body.Type = RICHTEXT then
(do your check for embedded objects here)
End If
now as I stated in my earlier post…LS doesn’t consider a doc link an embedded object, and to test for it, you’ll need to use a combination of the NotesRichTextNavigator and NotesRichTextDocLink objects to do the test.
body.EmbeddedObjects property recognises only file attachments, object links, and embedded objects But not the doclink which you mentioned in your previous posting. Hence the error.
This way you can find doclink:
Dim rtnav As NotesRichTextNavigator
Dim rtlink As NotesRichTextDocLink
dim dclnk as integer
Set body = doc.GetFirstItem(“Body”)
Set rtnav = body.CreateNavigator
Set rtlink = rtnav.GetFirstElement(RTELEM_TYPE_DOCLINK)