+ Reply to Thread
Results 1 to 8 of 8

Copying subject and body text of .msg files to excel

  1. #1
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Copying subject and body text of .msg files to excel

    I receive around 40 emails per day, all in the following format:

    Subject: "Team x.x - date"
    Body text: "x files sent"

    where x represents a number.

    What I'm hoping to be able to do is drop all these emails into a folder (in .msg format), and use excel to look through them and extract the team number from the subject, and the number of files sent from the body text for each message.

    Unfortunately, while I class myself as reasonably competent with excel vba, working with emails or .msg files is new to me, so I genuinely haven't a clue how to do this, or if it's even possible.

    Can anyone help?
    Last edited by madbloke; 11-18-2009 at 07:49 AM.

  2. #2
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Re: Copying subject and body text of .msg files to excel

    Any ideas? Or even any ideas of other places to search for info would be welcome.

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Copying subject and body text of .msg files to excel

    hi,

    What email application are you using eg Outlook (/Express), Lotus Notes...?
    If it's Outlook, did you know that you Outlook has its own object model which can be manipulated through VBA?
    Ooopps - reread your post & ".msg" files suggests it's a MS application. Is it Outlook?
    (Try searching for "outlook vba" & ?)
    I think you'd be able to do this more effectively from the Outlook side (using defined Rules & VBA) & it may even make you reasonably competent with Outlook VBA

    Here is a link to Ron DeBruin's site which is probably worth exploring for the excel side: http://www.rondebruin.nl/sendmail.htm

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  4. #4
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Re: Copying subject and body text of .msg files to excel

    Hmm. You mean get Outlook to export the values out to an excel sheet? Hadn't thought of that - I was planning on dragging the messages out to a folder.

    Worth a try, I guess! Off to google...

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Copying subject and body text of .msg files to excel

    Rather than Excel dragging the messages to a folder Outlook can push them.

    There will be many others, but "Sue Mosher" is one Outlook MVP so it may pay to include her name in your Search terms.

    Let us know how you go - I may see what I can come up with for you at some stage later in the week.

    Good luck
    Rob

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Copying subject and body text of .msg files to excel

    Also probably worth looking through the Outlook Forum(s) here ... though worth noting that although trapping the occurrence of new mail is trivial determining the new mail item can itself be a bit of a pain (somewhat oddly)

    The decision regards coding in OL and pushing data to XL or coding in XL and pulling data from OL will invariably depend upon the workflow specifics (ie run once a day, run when new mail received etc etc...)
    Last edited by DonkeyOte; 11-18-2009 at 07:10 AM.

  7. #7
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Re: Copying subject and body text of .msg files to excel

    Thanks all! Once I changed my perspective on this, the first link that came up in google had Outlook code to do pretty much exactly what I wanted.

    Bizarrely, searching for Outlook to Excel (rather than the other way round) also pulled up some Excel code, which fits my purpose even better! I've included the code below, just in case it's of use for anyone else.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Copying subject and body text of .msg files to excel

    brilliant - I'm pleased we were able to point you in the right direction
    Thanks for marking the post as solved.


    Rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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