Counting how many mail items have attachments in Outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there people ... is there some simple command or way for Outlook using VBA
that allows you to count how many mail items in the Inbox (or subfolder of
the Inbox) have an attachment to them (note: NOT the number of attachments in
each mail item).

VBAffled ... well sometimes at least :-)
 
Now it´s no joke :-)

You have to loop through the items and increase a counter variable each
time when MailItem.Attachments.Count>0

Because it´s faster I would use CDO for that instead of the Outlook
object model.
 
Thanks for the lead Michael.

Actually, I am ok with the "looping and the increasing of counter variables"
each time an attachment is encountered. My problem has been (as it was for my
previous post on counting mail items in Outlook) with the "terminology",
i.e., the use of MailItem.Attachments.Count as the correct way to determine
whether an attachment was there. It is just my lack of experience with the
Outlook language. The help in VBA is good but sometimes it can leave you a
little bit wanting for more (examples that is).

I wanted to try CDO after reading about the Security Object Model Guard in
Outlook but I felt lacking in that area.

Anyway, after a little bit of mucking around with your suggestion, I managed
to get it going so a big thank you Michael :-)
 
Back
Top