以下代码演示如何从Notes文档中拆离Excel格式的文件到指定路径C:/
Sub Initialize
On Error Goto ErrHandle
Dim ss As New NotesSession
Dim doc As NotesDocument
Dim varFile As Variant
Dim i As Integer
Dim obj As NotesEmbeddedObject
Set doc=ss.DocumentContext
varFile=Evaluate({@AttachmentNames},doc)
'没有附件退出
If varFile(0)="" Then Exit Sub
'从文档中拆离附件
For i=0 To Ubound(varFile)
'根据文件后缀拆离Excel文件
If Lcase(Strrightback(varFile(i),"."))<>"xls" Then
Set obj=doc.GetAttachment(varFile(i))
'文件拆离保存路径
Call obj.ExtractFile("C:/" & varFile(i))
End If
Next
Exit Sub
ErrHandle:
Msgbox "Error" & Err & " Erl:" & Erl
End Sub
本文介绍了一个VBA宏代码示例,用于从Notes文档中拆离Excel格式的附件,并将其保存到指定路径C:/。代码首先检查文档是否包含附件,然后遍历每个附件并根据文件扩展名判断是否为Excel文件,最后将符合条件的Excel文件拆离并保存。
243

被折叠的 条评论
为什么被折叠?



