代理代码如下:
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1
Sub
Initialize
2
3 On Error Goto MsgError
4 Dim session As New NotesSession
5 Dim doc As NotesDocument
6 Dim FilePath As String
7 Dim fileNames As Variant
8 Dim objEmbed As NotesEmbeddedObject
9
10 Set doc = session.DocumentContext
11 fileNames = Evaluate( " @AttachmentNames " ,doc) ' 获取文档所有附件名称
12 filePath = session.GetEnvironmentString( " Directory " ) ' 环境变量
13 If ( Isarray (fileNames)) Then
14 Forall fileName In fileNames
15 filePath = filePath + " \ " + fileName
16 Set objEmbed = doc.GetAttachment(filename)
17 Call objEmbed.ExtractFile(filePath) ' 将文档中的附件导出
18 Call objEmbed.Remove() ' 删除文档中的附件
19 End Forall
20 End If
21 Exit Sub
22
23 MsgError:
24 Msgbox " Error: " + Error $ + " onLine: " + Cstr (Erl)
25 End Sub
26
2
3 On Error Goto MsgError
4 Dim session As New NotesSession
5 Dim doc As NotesDocument
6 Dim FilePath As String
7 Dim fileNames As Variant
8 Dim objEmbed As NotesEmbeddedObject
9
10 Set doc = session.DocumentContext
11 fileNames = Evaluate( " @AttachmentNames " ,doc) ' 获取文档所有附件名称
12 filePath = session.GetEnvironmentString( " Directory " ) ' 环境变量
13 If ( Isarray (fileNames)) Then
14 Forall fileName In fileNames
15 filePath = filePath + " \ " + fileName
16 Set objEmbed = doc.GetAttachment(filename)
17 Call objEmbed.ExtractFile(filePath) ' 将文档中的附件导出
18 Call objEmbed.Remove() ' 删除文档中的附件
19 End Forall
20 End If
21 Exit Sub
22
23 MsgError:
24 Msgbox " Error: " + Error $ + " onLine: " + Cstr (Erl)
25 End Sub
26