保存电子邮件中zip文件夹内的受保护文件

时间:2018-07-05 13:12:40

标签: vba email passwords

我要从该电子邮件中保存的文件是一个受保护的文件,附加在电子邮件的zip文件夹中。我有密码,但是当我尝试输入密码时,它不起作用。现在,我通过以下方式手动保存填充:

  1. 打开zip文件

  2. 将文件拖到位置文件夹(他们当时要求我输入密码)

     Dim olApp As Outlook.Application
     Dim olNs As Namespace
     Dim Fldr As MAPIFolder
     Dim olMail As Variant
    
     Set olApp = New Outlook.Application
     Set olNs = olApp.GetNamespace("MAPI")
     Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
    
    Drive = "path..." 
    sFilter = "[ReceivedTime]>'" & Format(Now - 5, "DDDDD HH:NN") & "'"
    Set Fldr2 = Fldr.Items.Restrict(sFilter)
    Fldr2.Sort "[ReceivedTime]"
    For i = Fldr2.Count To 1 Step -1
        Subj = Fldr2(i).Subject
     If  Subj = "test"
       TempFile = Drive & Fldr2(i).Attachments(1).Filename
       Fldr2(i).Attachments(1).SaveAsFile TempFile, Password:="password" 
       Kill (TempFile)
     end if
    Next i
    

0 个答案:

没有答案