+ Reply to Thread
Results 1 to 9 of 9

Break Contents of Email into different cells

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Break Contents of Email into different cells

    I have the following code which works great at importing the emails, the only issue is the entire body is put in column D.
    Please Login or Register  to view this content.
    What I would like is for the code to import from outlook based on the subject line & then after each new line break add the text to the next column till it is completed. So this is the body of the email that comes out to me:

    Due to an Order Entry error we are requesting your assistance with completing a manual move as noted below:
    -- SSC Section --
    Requesting Agent: Ray Webber
    Agent Tier: 1
    Agent's Supervisor: Steven Morgan
    Offbooks Needed?: Yes
    Description of Error:

    RTS time stamped in OE but it never left the customers property
    **TSA/ART - For your convenience, the link to the specific item is here.**
    -- Market / Location Section --
    Customer Number: 123456789
    Customer Name: Harry Smith
    Customer Phone Number: 123-456-7891
    Order #: 123456
    Container: 28BX2
    Market: Chicago IL
    Type of Service Requested: Return to Storage
    Date Needed: 5/8/2019
    Summary of Action Needed:
    customer need time stamp removed

    Move To (Service) Address:

    storage center
    Move From Address:

    123 ABC Parkway, Bolingbrook, IL 60440 [USA]
    Complex: N/A
    Facing: Container door faces the building - Rear
    Street, Driveway or Parking Lot: In a private driveway
    Circular or Straight Driveway?: A straight 1 car
    Which side of the driveway?: N/A
    How far away from building/landmark?: 6 feet | Specific Distance (if appl): N/A
    Special Directions:
    Special Instructions: N/A
    Is this a gated community? No
    Gate Code or Instructions (If applicable):
    Cross Street 1: US 34
    Cross Street 2: South Eol Rd

    I have uploaded my workbook for any assistance you can provide. Thank you for any help in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,340

    Re: Break Contents of Email into different cells

    Written without testing but maybe try this straight after you add the body.

    Please Login or Register  to view this content.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  3. #3
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Break Contents of Email into different cells

    Modified Scott's code to skip blanks:
    Please Login or Register  to view this content.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  4. #4
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Break Contents of Email into different cells

    This works flawlessly, however there is one condition that I forgot to include. I only want emails that has the subject line starting with "Offbooks/TSA Request:" to be pulled from Outlook - I know it would be an If Then statement, however not 100% sure where it would fit into the code. Would it be before or after the For Each line?

  5. #5
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Break Contents of Email into different cells

    It would go after the For Each to test each subject before applying logic:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Break Contents of Email into different cells

    Is there a line that will also pull the category that the email has been marked as in Outlook?

  7. #7
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Break Contents of Email into different cells

    I suggest you bookmark the office object model - it has all the objects, properties & methods of whatever app you need and is a handy reference. This is the link to the Categories collection in Outlook: https://docs.microsoft.com/en-us/off...ook.categories and it has sample code you should be able to adapt.

    HTH.
    MM.

  8. #8
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Break Contents of Email into different cells

    Im so sorry for my ignorance but I am completely lost with this - it keeps giving me an error - can you take a look at it for me?

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Break Contents of Email into different cells

    Categories is a collection; it will return a string of all categories assigned to an item separated by a comma. I don't have categories in Outlook (not supported by IMAP) but this should give you the idea:
    Please Login or Register  to view this content.

+ 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. [SOLVED] Delete last break at the end of cell's contents.
    By mainemojo in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-19-2018, 09:34 PM
  2. Copy email contents to new email whilst saving attachment.
    By X82 in forum Outlook Programming / VBA / Macros
    Replies: 25
    Last Post: 08-18-2015, 03:16 PM
  3. Replies: 1
    Last Post: 07-15-2011, 05:29 PM
  4. Replies: 11
    Last Post: 10-31-2010, 12:24 PM
  5. Automatic email of excel contents as email body
    By naveenn08 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2009, 08:26 AM
  6. merged cell's contents cut off beyond page break
    By 8thWonder in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2009, 10:52 AM
  7. One email using contents from multiple cells using Lotus Notes
    By tommytee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2008, 07:59 AM

Tags for this Thread

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