Hi,
I want to extract an embedded object from a RT item in a document and then attach it to another item in another document. All the examples in this regard create a new RT item and then call the EmbedObject method. How do I embed it in an existing RT field? I tried the following piece of code but it didn’t work :
Set rt_source = doc_source.GetFirstItem(“Title”)
Set rt_dest = doc_dest.GetFirstItem(“Subject”)
Forall emb_obj in rt_source.EmbeddedObjects
Call emb_obj.ExtractFile("C:"& emb_obj.source)
Set emb_obj2 = rt_dest.EmbedObject(emb_obj.Type,“”,"C:"& emb_obj.source)
Kill "C:"& emb_obj.source
End Forall
It fouls up in the call to EmbedObject … The error is “Object Variable Not Set” This error doesn’t happen if I replace the statement
Set rt_dest = doc_dest.GetFirstItem(“Subject”)
with
Set rt_dest = doc_dest.CreateRichTextItem(“Sub”)
What am I doing wrong?