c_dewitt
c_dewitt

Reputation: 11

Outlook Attachment Count

I'm writing some code to save Outlook emails and I need to know the number of attachments. To get an attachment count have this code. When there are no attachments nAttach is 0 as expected but when there are n attachments I get n+1. I tried using nAttach -1 to correct it but then it bumped up again or sometimes if i have 1 attachment it would come out to 0.

  Dim oMail As Outlook.MailItem
  Dim sAttach As String
  Dim nAttach As Integer
     
  nAttach = oMail.Attachments.Count
  If nAttach > 0 Then nAttach = nAttach - 1
  sAttach = CStr(nAttach)

Upvotes: 1

Views: 681

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66286

The attachment count is most likely right. Note that embedded HTML images can be attachments even if Outlook does not show them in the list of attachments.

Upvotes: 1

Related Questions