我正在尝试使用VBA将附件文件插入Lotus Notes文档中。这是我正在使用的代码的简化版本:
Dim Anotesuiworkspace as Object
Dim NUIdoc As Object
Dim rtitem As Object
Dim FileName As String
这会创建一个新文档并在Lotus Notes上打开它
Set Anotesuiworkspace = CreateObject("Notes.Notesuiworkspace")
Set NUIdoc = Anotesuiworkspace.composeDocument("", "", "Dash 8 request")
随机文件位置
FileName = "C:\Users\k0600292\Desktop\Vacation Tracker\Andy Vacation.xlsx"
'$FILE is the name of the Field I am looking to attach the document into
'Get an error while running the next line saying "Object doesnt support this property or method"
Set rtitem = NUIdoc.GetFirstItem("$FILE")
Set object = rtitem.EmbedObject(EMBED_ATTACHMENT, "", FileName)
End Sub
非常感谢任何建议/建议。
答案 0 :(得分:1)
1)您没有将文件嵌入/附加到$ FILE中。您将它附加到窗体上的富文本字段。字段$ FILE是一个系统字段 2)您只能使用后端类附加文件。 EmbedObject()是NotesDocument类的方法,而不是NotesUIDocument的方法,
您的代码应如下所示:
Set doc = uidoc.Document
Set rtitem = doc.GetFirstItem("AttachmentRTField")
Set object = rtitem.EmbedObject(EMBED_ATTACHMENT, "", filename)