Outlook脚本VBA不起作用

时间:2012-11-22 19:29:01

标签: outlook outlook-2010 outlook-vba

我已将此脚本复制为从邮件到文件夹的单独附件。

       Public Sub ProcessarAnexo(Email As MailItem)
       Dim diretorioAnex As String
       diretorioAnex = "C:\Separados"

       Dim MailID As String
       Dim mailx As Outlook.MailItem

       MailID = Email.EntryID
       Set Mail = Application.Session.GetItemFromID(MailID)

       For Each anexo In mailx.Attachments
           If Rigth(anexo.FileName, 3) = "xml" Then
           MsgBox (anexo.FileName)
           anexo.SaveAsFile directorioanex & "\" & anexo.FileName
       End If
       Next
       Set mailx = Nothing

        End Sub

我尝试从“立即执行规则”执行脚本,但它不会在“Separados”文件夹中保存任何内容。

1 个答案:

答案 0 :(得分:0)

该脚本有效,Outlook 2010已阻止宏和代码,我已启用OutLook来运行VBA和宏,所有运行正常。

由于