Results 1 to 9 of 9

Thread: code to get the email header

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Regular
    Joined
    Apr 2016
    Posts
    22
    Location
    ok, so now i have some questions. i am able to pull the sender, to, subject and names of attachments. the problem is that the procedure is running on the selected item and not the new incoming email. how can i fix that?

    turns out the GetAttachmentList procedure is picking up the current selection, how can i make that run for incoming emails?

    Public Sub GetAttachmentList()
        Dim selItem As Object
        Dim aMail As MailItem
        Dim aAttach As attachment
        Dim Report As String
         
        For Each selItem In Application.ActiveExplorer.Selection
            If selItem.Class = olMail Then
                Set aMail = selItem
                For Each aAttach In aMail.Attachments
                    'Report = Report & vbCrLf & "------------------------------------------------------------------------" & vbCrLf
                    Report = Report & GetAttachmentInfo(aAttach)
                Next
                Call CreateReportEmail("Attachment Report", Report)
            End If
        Next
    End Sub
    Last edited by danmc58; 10-02-2019 at 11:21 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •