- To post as a guest, your comment is unpublished.· 2 years agoThis is because "oItem.Attachments.Count" also counts embedded pictures (for example in the signature) as attachments. So this code will not work as intended once such an e-mail is part of the selection.
How to count the total number of attachments in selected emails in Outlook?
I frequently receive emails with attachments which take up huge space in Microsoft Outlook. And now I want to count the total number of attachments for metrics and revising. Any good ideas? I find out two workarounds to solve this problem:
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by rules; Auto Reply without exchange server, and more automatic features...
- BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
- Reply (All) With All Attachments in the mail conversation; Reply Many Emails at once; Auto Add Greeting when reply; Auto Add Date&Time into subject...
- Attachment Tools: Auto Detach, Compress All, Rename All, Auto Save All... Quick Report, Count Selected Mails, Remove Duplicate Mails and Contacts...
- More than 100 advanced features will solve most of your problems in Outlook 2010-2019 and 365. Full features 60-day free trial.
This method will introduce a VBA to count the total number of attachments in selected emails in Outlook. Please do as follows:
1. Select the emails whose attachments you will count, and press the Alt + F11 key simultaneously to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below VBA code into the opening Module window.
VBA: Count the number of attachments in selected emails
Sub CountAttachmentsMulti() Dim oItem As Object Dim iAttachments As Integer For Each oItem In ActiveExplorer.Selection iAttachments = oItem.Attachments.Count + iAttachments Next MsgBox "Selected " & ActiveExplorer.Selection.Count & " messages with " & iAttachments & " attachements" End Sub
3. Press the F5 key or click the Run button to run this VBA.
And now a dialog box comes out and displays how many attachments there are in the selected emails. See screenshot:
If you have Kutools for Outlook installed, you can easily apply the Detach All (Attachments) feature to export all attachments from multiple selected emails, and then count exported attachments easily. Please do as follows:
1. Select the emails whose attachments you will export and count, and click Kutools > Others > Detach All. See screenshot:
2. A dialog box will come out and ask for your reconfirmation about detaching attachments. Please click the Yes button to go ahead.
3. In the opening Browse For Folder dialog box, please specify a folder you will save the exported attachments into, and click the OK button.
And now all attachments in the selected emails are exported and saved into the destination folder.
4. Open the destination folder, and select all the attachments you exported just now, and you will get the number of exported attachments at the Status bar of opening folder. See screenshot:
Note: If one email contains more than one attachment, these attachments will be saved into one folder and named with this email’s subject.
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
- Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
- Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
- Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 3 years agoThis code is great and all but for some reason the number it is counting as email 'attachments' is wrong. There are 19 email attachments and its saying there are 22. Is this counting something else as an attachment?