【发布时间】:2016-12-01 07:01:29
【问题描述】:
我有一个要求,其中有一个带有附件的文档,当我单击一个按钮时,它会打开一个新表单。此表单必须在富文本字段中包含该附件。我在打开的新表单的 PostOpen 事件中编写了以下代码
Set item1= tardoc.GetFirstItem("Comments")
Set item= sourcedoc.GetFirstItem("Current_US")
If Not item Is Nothing Then
If item.Type = RICHTEXT Then
Set rtitem = item
If Not Isempty(rtitem.EmbeddedObjects) Then
Forall fileItem In rtitem.EmbeddedObjects
If fileItem.Type = EMBED_ATTACHMENT Then
Call fileItem.ExtractFile(filepath _
& Cstr(fileItem.Name))
attFile = filepath & Cstr(fileItem.Name)
Call item1.EmbedObject( EMBED_ATTACHMENT, "", attFile)
End If
End Forall
End If
End If
End If
sourcedoc 是必须从中复制附件的文档,tardoc 是必须将附件复制到的文档,它也是打开的新文档,因此在此表单的 postopen 事件中,我已经写了代码。但是在这一行代码失败说对象变量未设置。 调用 item1.EmbedObject(EMBED_ATTACHMENT, "", attFile)
【问题讨论】: