I have written the code like this
dim ws as new notesuiworkspace
dim uidoc as notesuidpcument
dim rtitem as varient
Dim object As NotesEmbeddedObject
rtitem = Cstr(doc.GetFirstItem(“LongDescription”))
If rtitem.Type= RichText Then
Set object = rtitem.EmbeddedObject ( EMBED_ATTACHMENT, "", "filepath$")
End If
but i got the error varient doesnot contain object
Subject: varient doesnot contain object
Where is “doc” declared"?
What is a notesuidpcument?
What is a varient?
if you switch on the LotusScript debugger, it will tell you which line you are getting the error on. You can then work out what has not been set
Subject: RE: varient doesnot contain object
And why, oh why, would anyone cast a NotesItem to a String?
Subject: I heard God works in mysterious ways? Could that be the reason?
Subject: RE: I heard God works in mysterious ways? Could that be the reason?
Option Declare is your friend! Don’t feer the Option.
Subject: varient doesnot contain object
You should check to see if “LongDesciption” exist.
if doc.HasItem(“LongDescription”) then
rtitem = Cstr(doc.GetFirstItem("LongDescription"))
If rtitem.Type= RichText Then
…
End if
End if
Isn’t rtitem always going to be a String? Given the “CStr()” function call. Therefore the check of the Type seems out of place.