![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi everyone,
I have been trying to write a macro in Excel to achieve the following: - search for an item with a particular subject in the Outlook inbox (there will always be only one item to match the search criteria since the items are deleted after being processed) - open that particular item and copy its body to a designated Excel spreadsheet -delete the item So far, the closest I have come to my objective is with the below code. My problem is that it ends up pasting the entire body of the email in one single cell in Excel (it would not accept pasting in a range) and there is no possibility for me to format the data afterwards. Please help if you have a minute, I honestly don't know what else to try. Many thanks, Alex Sub Outlook_Final() Set olApp = CreateObject("Outlook.Application") Dim olNs As Outlook.Namespace Dim Fldr As Outlook.MAPIFolder Set olApp = New Outlook.Application Set olNs = olApp.GetNamespace("MAPI") Set Fldr = olNs.GetDefaultFolder(olFolderInbox) For Each Item In Fldr.Items If InStr(Item.Subject, "MACRO VAX 48634 REPORT") 0 Then Item.Display vBody = Item.Body ActiveWorkbook.Sheets("Sheet1").Range("A1").Value = vBody Item.Delete End If Next Item End Sub |
Ads |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Export body of email to Excel | Jim[_15_] | Outlook - General Queries | 2 | April 14th 09 05:14 PM |
Copy a range from Excel to Oulook MailItem's body as Bitmap | WhytheQ | Outlook and VBA | 8 | November 2nd 07 01:33 PM |
Copy contents of Excel range name to Email Subject line | [email protected] | Outlook and VBA | 3 | June 21st 07 07:14 AM |
Need help with 2 HTML files in the body of an email using excel co | Trefor | Outlook and VBA | 7 | January 11th 07 05:28 AM |
Paste an Excel Chart in an Outlook Body | [email protected] | Outlook and VBA | 1 | September 27th 06 06:39 AM |