outlook自动下载附件

打开Outlook - Option - Trust Center - Truster Center Settings - Macro Settings - 勾选Enable all macros。

 

打开Outlook - Option - Trust Center - Truster Center Settings - Email Security - 勾选Allow script in shared folders 和 All script in public folders

重点:重启Outlook

编写宏程序,按下Alt+F11,创建新项目,把程序copy进去,文件夹地址改一下

preview

 

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

Public Sub SaveAttach(MyItem As Outlook.MailItem)
    SaveAttachment MyItem, "C:\Data\MailAttached\" ,"*.xlsx"
    'MsgBox "附件已保存"
End Sub

Private Sub SaveAttachment(ByVal Item As Outlook.MailItem, path, Optional condition = "*")
    Dim olAtt As Outlook.Attachment
    Dim i As Integer
    Dim dateFormat
    dateFormat = Format(Now, "yyyy-mm-dd hh-mm-ss")
    If Item.Attachments.Count > 0 Then
        For i = 1 To Item.Attachments.Count
            Set olAtt = Item.Attachments(i)
            If olAtt.FileName Like condition Then
                olAtt.SaveAsFile path & dateFormat & "_" & olAtt.FileName
            End If
        Next
    End If
    Set olAtt = Nothing
    Sleep 1000
End Sub

第三步:

制作运行规则

打开注册表编辑器regedit,在路径HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security下增加一个DWORD值型的EnableUnsafeClientMailRules项,设置值为1

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值