|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
这个百度就有;
代码如下, 我在使用。
然后建个规则。
- Sub SaveAttachment(ByVal Item As Object, path$, Optional condition$ = "*")
- Dim olAtt As Attachment
- Dim i As Integer
- If Item.Attachments.Count > 0 Then
- For i = 1 To Item.Attachments.Count
- Set olAtt = Item.Attachments(i)
- ' save the attachment
- If olAtt.FileName Like condition Then
- olAtt.SaveAsFile path & olAtt.FileName
- End If
- Next
- End If
- Set olAtt = Nothing
- End Sub
- Sub 保存(Item As Outlook.MailItem)
- SaveAttachment Item, "D:\文件夹称", "*.xlsx"
- End Sub
复制代码 |
|