+ Reply to Thread
Results 1 to 14 of 14

Export Outlook emails to Excel

Hybrid View

vikas_newports Export Outlook emails to Excel 11-06-2021, 01:31 PM
vikas_newports Re: Export Outlook emails to... 11-07-2021, 02:04 PM
bsalv Re: Export Outlook emails to... 11-07-2021, 02:21 PM
vikas_newports Re: Export Outlook emails to... 11-07-2021, 02:33 PM
bsalv Re: Export Outlook emails to... 11-07-2021, 04:10 PM
vikas_newports Re: Export Outlook emails to... 11-10-2021, 01:59 PM
bsalv Re: Export Outlook emails to... 11-10-2021, 03:27 PM
vikas_newports Re: Export Outlook emails to... 11-11-2021, 02:12 PM
bsalv Re: Export Outlook emails to... 11-11-2021, 05:21 PM
vikas_newports Re: Export Outlook emails to... 11-12-2021, 02:11 PM
cwebb3555 Re: Export Outlook emails to... 11-30-2021, 11:16 AM
bsalv Re: Export Outlook emails to... 11-30-2021, 12:31 PM
cwebb3555 Re: Export Outlook emails to... 11-30-2021, 12:36 PM
cwebb3555 Re: Export Outlook emails to... 12-01-2021, 07:03 PM
  1. #1
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Export Outlook emails to Excel

    Hello
    I am thankful to this forum where experts help and resolve issue .
    I want to fetch email from outlook to Excel sheet.
    I tried various vba code from internet and no one is working for me.
    I am using most of the time microsoft 365 and sometime Office 2016 or 2019 on other machines.

  2. #2
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Export Outlook emails to Excel

    Dump for help

  3. #3
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Export Outlook emails to Excel

    What do you want ? The subject, the body, the attachments ?
    Here are some macros : http://www.snb-vba.eu/VBA_Outlook_external_en.html#L_6
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  4. #4
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Export Outlook emails to Excel

    Quote Originally Posted by bsalv View Post
    What do you want ? The subject, the body, the attachments ?
    Here are some macros : http://www.snb-vba.eu/VBA_Outlook_external_en.html#L_6
    I want to get the Email date, Sender email, Subject

  5. #5
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Export Outlook emails to Excel

    properties : http://www.snb-vba.eu/VBA_Outlook_external.html#L_2.0 (dutch)
    http://www.snb-vba.eu/VBA_Outlook_ex..._en.html#L_2.0 (english)

    Outlook, for safety, 'll ask you how long you want access 1, 2, 5 minutes !
    Choice the desired time and click "accept"
    see dutch screenshot
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by bsalv; 11-07-2021 at 04:15 PM.

  6. #6
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Export Outlook emails to Excel

    Sorry for late response , i am getting the error on below line
    Application.StatusBar = LO.ListRows.Count & Space(5) & arr(1)
    Moreover it is fetching the emails from 23-Sep-2021 , while i have plenty of emails after this date too .
    I want to fetch unread emails from folder IMPORTANT EMAILS

  7. #7
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Export Outlook emails to Excel

        For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").Folders("MyEmailaddress@outlook.com").Folders("Post IN").Folders("another subfolder").Folders("important emails").items
    You want this !
    1st red string : your emailaddress
    then I supposed your important emails were in the folder "Post In" subfolder "another subfolder" subsubfolder "important emails"
    You check the structure of your folders

  8. #8
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Export Outlook emails to Excel

    Thanks its working but it is fetching all emails from folder instead of Unread emails.,

  9. #9
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Export Outlook emails to Excel

    just a guess
    For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").Folders("MyEmailaddress@outlook.com").Folders("Post IN").Folders("another subfolder").Folders("important emails").items
              If it.unread Then
                   ReDim arr(1 To 5)                                'clear array
                   On Error Resume Next
                   arr(1) = it.Subject
                   arr(2) = it.senderName
                   arr(3) = it.CreationTime
                   arr(4) = it.ReceivedTime
                   On Error GoTo 0
    
                   LO.ListRows.Add.Range.Range("A1").Resize(, UBound(arr)).Value = arr
                   Application.StatusBar = LO.ListRows.Count & Space(5) & arr(1)
              End If
         Next

  10. #10
    Forum Contributor
    Join Date
    05-26-2016
    Location
    India
    MS-Off Ver
    Microsoft 2021
    Posts
    324

    Re: Export Outlook emails to Excel

    Quote Originally Posted by bsalv View Post
    just a guess
    For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").Folders("MyEmailaddress@outlook.com").Folders("Post IN").Folders("another subfolder").Folders("important emails").items
              If it.unread Then
                   ReDim arr(1 To 5)                                'clear array
                   On Error Resume Next
                   arr(1) = it.Subject
                   arr(2) = it.senderName
                   arr(3) = it.CreationTime
                   arr(4) = it.ReceivedTime
                   On Error GoTo 0
    
                   LO.ListRows.Add.Range.Range("A1").Resize(, UBound(arr)).Value = arr
                   Application.StatusBar = LO.ListRows.Count & Space(5) & arr(1)
              End If
         Next
    Thanks its working fine now

  11. #11
    Registered User
    Join Date
    11-30-2021
    Location
    Port Richey, Florida
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Export Outlook emails to Excel

    Hi, New to the Forum and looking for some help on the following:
    Getting Run Time Error2147221233(8004010f' on this line- Set Folder = OutlookNamespace.GetDefaultFolder(olFolderInbox).Folders("Leads")
    Please help, Thanks in advance

  12. #12
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,449

    Re: Export Outlook emails to Excel

    * where is ".GetNamespace("MAPI")", is that integrated in "outlooknamespace" ?
    * "Leads" is a folder in "Post In" ?
    * set Folder = ...., Folder is a term used in VBA, so it's better not to use that as name for a variable.
    Try : Set FolderLeads = OutlookNamespace.GetDefaultFolder(olFolderInbox).Folders("Leads")
    or anything else that is slightly different to "Folder"

  13. #13
    Registered User
    Join Date
    11-30-2021
    Location
    Port Richey, Florida
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Export Outlook emails to Excel

    This is the whole code I used. The highlight is what has the error
    Sub GetOutlookData()

    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("Leads")

    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

  14. #14
    Registered User
    Join Date
    11-30-2021
    Location
    Port Richey, Florida
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Export Outlook emails to Excel

    Really wish I could get some help on this

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Export Emails from Outlook to Excel (MAC)
    By kingofcamden in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 11-21-2019, 07:31 AM
  2. Export Outlook Folder Emails to excel -- need body separated
    By BG1983 in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2017, 02:11 PM
  3. [SOLVED] Export specific rows of data into unique outlook emails per client
    By ryanexceln00b in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2013, 09:24 AM
  4. Export Outlook Emails to Excel
    By nexami in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2013, 05:05 AM
  5. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  6. Export emails from Outlook to Excel
    By ExcelStud in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2012, 11:22 AM
  7. Export outlook emails - Security information
    By joe_for_good in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2011, 05:24 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1