Removing Attachments

I want to remove attachments in one document…I have a simple code below…But its not working…Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim Filedialog As NotesEmbeddedObject



Set uidoc=ws.CurrentDocument

Set doc=uidoc.Document

Set  rtitem=doc.GetFirstItem("DVPR")

Set filedialog=rtitem.EmbeddedObjects

Call Filedialog.Remove

Call doc.save(True,True)	

End Sub

What can be the reason?

I tried to define the array of NotesEmbeddedObject…but by that also its not working…

Thanks in Advance…

Subject: Removing Attachments.

Use a Variant instead.

Subject: Removing Attachments.

But its not working…What can be the reason? Any error message? What is not working?

“The CRISPY initiative”

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/410171d83ddba6d485256df100832aba?OpenDocument

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/5260e95508a2a6df8525711d00738ebf?OpenDocument

Subject: RE: Removing Attachments.

Well…I had to scamper to some new work…Thats why I was not able to ask a question in a neat manner…Sorry for that…The error msg is coming as Type Mismatch on the line

Set filedialog=rtitem.EmbeddedObjects

This has to do with defining array of NotesEmbeddedObject. But I tried by defining array of Embedded Objects…But the same error of Type Mismatch is coming.

What can be the reason.

And to answer What is not working…It has obvious answer that the code which I had pasted is not working…

Subject: RE: Removing Attachments.

Type Mismatch means that the type of something does not match what was expected. You declared filedialog as a NotesEmbeddedObject. Then you try to assign it a value:

Set filedialog=rtitem.EmbeddedObjects

What datatype is rtitem.EmbeddedObjects? Is it a NotesEmbeddedObject? No, if you read the documentation you’ll find it’s an array of objects. It doesn’t match the variable.

You must declare the variable as Variant, and don’t use Set. This is what Harkpabst meant by his answer, also.