代理代码如下:
代码
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