+ Reply to Thread
Results 1 to 2 of 2

How to extract outlook mail full body context and not just the text?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-17-2015
    Location
    london
    MS-Off Ver
    2010
    Posts
    2

    How to extract outlook mail full body context and not just the text?

    Hi, sorry for the repost, my previous thread was a bit confusing:

    I would like to extract the content in the mail onto excel spreadsheet, the following code worked for me but it only extracts the olMail.Body which is the plain text, but I receive data in excel table format (i.e. when you copy a table from excel directly into email), but I cant seem to extract it, could someone pls help me amend the below code? thank you so much!

    Sub GetFromInbox()
    
         Dim olApp As Outlook.Application
         Dim olNs As Namespace
         Dim Fldr As MAPIFolder
         Dim olMail As Variant
         Dim i As Integer
    
         Set olApp = New Outlook.Application
         Set olNs = olApp.GetNamespace("MAPI")
         Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
         
         i = 1
    
         For Each olMail In Fldr.Items
             If InStr(olMail.Body, "testt") > 0 Or _
                 InStr(olMail.Subject, "testt") > 0 Then
    
                 ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime
                 i = i + 1
             End If
         Next olMail
    
         Set Fldr = Nothing
         Set olNs = Nothing
         Set olApp = Nothing
    
     End Sub
    Last edited by FDibbins; 08-18-2015 at 02:29 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract outlook mail full body context and not just the text?

    HI, welcome to the forum

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I will add them for you - this time
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Replies: 0
    Last Post: 08-17-2015, 11:00 PM
  2. Format Outlook Mail Body using VBA
    By prabhubox@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2014, 07:02 AM
  3. Replies: 1
    Last Post: 01-20-2014, 09:31 AM
  4. [SOLVED] How to copy table from Outlook mail body in to text file
    By Draconi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2013, 02:43 AM
  5. Convert text into bitmap and paste on mail body of outlook
    By Deepak -WFM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-20-2013, 07:12 AM
  6. Send e-mail with image on body (.html) on e-mail manager <> outlook
    By mariotnc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:28 PM
  7. Extract outlook message body text with VBA from Excel
    By jamsta1972 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-31-2012, 05:43 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