Type Mismatch on Forall o in doc.EmbeddedObjects

We can check the rich text field for attachments before looping for all the attachments in RT field. To check the rich text field we can use “IsEmpty” function.We can not user “IsNull” function.

Dim doc As NotesDocument

Dim rtitem As Variant

'…set value of doc…

Set rtitem = doc.GetFirstItem( “Body” )

If ( rtitem.Type = RICHTEXT ) Then

attachexist = rtitem.EmbeddedObjects

If Isempty(attachexist) = False Then

Forall o In rtitem.EmbeddedObjects

If ( o.Type = EMBED_ATTACHMENT ) Then

  Call o.ExtractFile( "c:\samples\" & o.Source )

  Call o.Remove

  Call doc.Save( False, True )

End If

End Forall

End If

End If

Subject: Type Mismatch on Forall o in doc.EmbeddedObjects

You should check for IsArray too?

Subject: Type Mismatch on Forall o in doc.EmbeddedObjects

Try using the HasEmbedded property of NotesDocument to check whether there are any embedded objects/attachments in the document/rich text field.

Pete