Results 1 to 4 of 4

Thread: Extract email messages from outlook to excel with attachment(s) information
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Extract email messages from outlook to excel with attachment(s) information

    Dear All,

    I have this vba which will extract the outlook messages to excel however I am not sure how can extract the attachment information along with this. Requesting your help please

    Sub GetFromOutlook()

    Dim OutlookApp As Outlook.Application
    Dim OutlookNamespace As Namespace
    Dim Folder As MAPIFolder
    Dim OutlookMail As Variant
    Dim i As Integer

    Set OutlookApp = New Outlook.Application
    Set OutlookNamespace = OutlookApp.GetNamespace("MAPI")
    Set Folder = OutlookNamespace.GetDefaultFolder(olFolderInbox).Folders("Testing")

    i = 1

    For Each OutlookMail In Folder.Items
    If OutlookMail.ReceivedTime >= Range("From_date").Value Then
    Range("eMail_subject").Offset(i, 0).Value = OutlookMail.Subject
    Range("eMail_date").Offset(i, 0).Value = OutlookMail.ReceivedTime
    Range("eMail_sender").Offset(i, 0).Value = OutlookMail.SenderName
    Range("eMail_text").Offset(i, 0).Value = OutlookMail.Body

    i = i + 1
    End If
    Next OutlookMail

    Set Folder = Nothing
    Set OutlookNamespace = Nothing
    Set OutlookApp = Nothing

    End Sub

  2. #2
    Board Regular
    Join Date
    Jul 2014
    Location
    The Netherlands
    Posts
    1,263
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Extract email messages from outlook to excel with attachment(s) information

    Hi,

    Can you describe your exact need a bit more extensive:
    1. is there always just 1 attachement or could there be multiple attachement;
    2. what's the type of information you want stored in the excel file, eg filename or ....
    Last edited by jorismoerings; Aug 29th, 2019 at 03:09 AM.
    --------------------------------------------------------------------------------
    If you found my answer helpful, please hit the Like or Thank button.

    Please follow the forum Rules and Guidelines and use Code tags around your VBA code.

    Remember: test VBA code always on a copy of your file because usually you can't use <undo>

  3. #3
    New Member
    Join Date
    Aug 2019
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Extract email messages from outlook to excel with attachment(s) information

    Hi Joris,
    Subject Date Sender Email Text Attachment(s)

    Thank you much for immediate reply. I have provided the format with required fields (unable to attach the file).

    1. Whatever files that the email has as an attachment to be downloaded
    2. the attachment can be saved to a folder and link can be given here.

    Option 1 would be much helpful

  4. #4
    New Member
    Join Date
    Aug 2019
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Extract email messages from outlook to excel with attachment(s) information

    Hi,

    Can anyone help please

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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