Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Outlook and Excel
I need expert help. This code searches four lines in the body of the
email, and copies it to excel by column. I would like to add two more columns where the date email was received and email subject are also included. Sub bodyStrip(msg As Outlook.MailItem) Dim sBody As String Dim aFields As Variant Dim r As Range Dim n&, iPos1&, ipos2& aFields = Array("Order Number:", "UIC ID:", "UIC Short Name:", "Order Status:") Set r = [a65536].End(xlUp).Offset(1).Resize(, 4) sBody = msg.Body For n = 1 To 4 iPos1 = InStr(ipos2 + 1, sBody, aFields(n - 1)) If iPos1 0 Then iPos1 = iPos1 + Len(aFields(n - 1)) ipos2 = InStr(iPos1 + 1, sBody, vbCrLf) r(n) = Mid(sBody, iPos1, ipos2 - iPos1) Cells.Columns.AutoFit Else Exit For End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Push Button in Outlook to Change Focus to Outlook Contact List | Excel Programming | |||
excel open in outlook if outlook is running | Excel Discussion (Misc queries) | |||
Outlook Automation Error Problem - Can't locate Outlook Module | Excel Programming | |||
How can I use Outlook express to send mail rather than Outlook by VBA code | Excel Programming | |||
Late Binding to Outlook from Excel: Outlook modifies email body | Excel Programming |