Outlook收件箱规则,无需实际下载附件即可获取附件的文件名 [英] Outlook inbox rule to get attachments' filename without actually downloading the attachments

查看:246
本文介绍了Outlook收件箱规则,无需实际下载附件即可获取附件的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立一个传入规则来获取附件的文件名,并将其自动写入excel,而不必下载附件本身.无论如何,在Outlook VBA中使用POP3或IMAP可以做到这一点吗?

I'm trying to set up an incoming rule to get the attachments' filename and write them to excel automatically without having to download the attachments itself. Is there anyway to do this with POP3 or IMAP in Outlook VBA?

推荐答案

尝试下面的代码..它可以帮助您浏览收件箱文件夹并获取每个附件的文件名..

Try The code below .. It helps you to go through your inbox folder and get every attachment filename ..

Sub test()
    Dim a As Attachments
    Dim myitem As Folder
    Dim myItemI As Object
    Dim j As Long
    Dim i As Integer

    ' Your Inbox folder
    Set myitem = Session.GetDefaultFolder(olFolderInbox)

    ' Loop through all mails in Inbox Folder
    For i = 1 To myitem.Items.Count
        'Get the mail number i
        Set myItemI = myitem.Items(i)
        'Get the attachments of the mail number i
        Set a = myItemI.Attachments
        ' if the mail contains attachments
        If Not a Is Nothing Then
            'Go through and display each attachment filename
            For j = 1 To myItemI.Attachments.Count
              MsgBox myItemI.Attachments.Item(j).DisplayName
            Next j
        End If
    Next i

End Sub

这篇关于Outlook收件箱规则,无需实际下载附件即可获取附件的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆