ERROR with NotesRichTextItem!

just look the code:(NOTE: Item “WordFiles” is a richtext item)

vItem = doc.getfirstitem( “WordFiles” )

sFileName = Dir$( sPath + “*.*”, 0 )

While sFileName <> “”

Set ne = vIitem.GetEmbeddedObject( sFileName )

If Not ne Is Nothing Then

	Call ne.Remove()

End If

sFileName = Dir$()

Wend

First time loop is correct, but seconde time loop error in:

Set ne = rtitem.GetEmbeddedObject( sFileName )

error message is: “Item WordFiles is invalid”

Subject: ERROR with NotesRichTextItem!!!

I do not see a problem with the code. Just from the top of the head. Would it be working if you save the doc just after removing the embeded object?

Subject: RE: ERROR with NotesRichTextItem!!!

I’ve never tried to do exactly what you’re doing, but if you call vitem.Update after the Remove, that might help.