以下代码演示如何从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