Macro to foward just a specific part of an email body of message

J

jwkolker

Hello - I am resonably versed in VBA but mostly for Access and Excel -
I am just starting to dabble in Outlook macros to automate stuff for
users.

Here's the latest I am trying to get done (and obviously would love
code suggestions for...)

1. Email comes in for order information

Example follows:
==================================================
Store ID: westwayeshop
Date order placed: Tue Apr 04 15:05:18 2006
Order Number: 1438

ShopSite Transaction ID: 10172-1144177444



Billing Address:
-----------------
Customer Name: mr mark Gordon
Company:
Address: 1232 S. Ervay St.
City: Dallas
State/Province: TX
Zip Code: 75215
Country: United States
Phone Number: 800-348-3888
Email: (e-mail address removed)

The shipping address is the same as the above address

Comments / More Information

Special Ordering Instructions (if any)




Qty Name W_Num Each Subtotal
------------------------------------------------------------------------
200 83R BRK BATTRY SMK DET W000377 $9.31
$1,862.00
------------------------------------------------------------------------
Subtotal
$1,862.00
Shipping: UPS Ground
$100.00
Tax Total
$0.00
Grand Total
$1,962.00

Payment type: Visa


Order Processing Info:
*ANET-SALE*:1066828242:055182,N,,This transaction has been approved.:

To retrieve payment information on this order, click on the 'Orders'
button from within ShopSite.
Shopsite URL:
https://commerce29.pair.com/ontops/cgi-bin/ss/cgiwrap.cgi/ontops/ss/start.cgi

This store is powered by ShopSite web catalog software.

===================================================
End of Sample

2. Now - what I want to do is strip out only the billing address and
order items
Like this
=====================================================
Billing Address:
-----------------
Customer Name: mr mark Gordon
Company:
Address: 1232 S. Ervay St.
City: Dallas
State/Province: TX
Zip Code: 75215
Country: United States
Phone Number: 800-348-3888
Email: (e-mail address removed)

The shipping address is the same as the above address

Comments / More Information

Special Ordering Instructions (if any)




Qty Name W_Num
------------------------------------------------------------------------
200 83R BRK BATTRY SMK DET W000377
======================================================

3. Now - I want to add some of my own text above and or below this text

4. Write something in the Subject Line - Like "Purchase Order
request...."

5. Pop open the Address book and default to addresses starting with
"Supplier - *"

6. After send then move to folder (this I may get done with a rule)...

NOTES -
- There may be multiple lines of products listing in the original
email
- The email comes formatted as plain text

Any help with this or even parts of this would be greatly appreciated.

Thanks.

John Kolker
 
M

Michael Bauer [MVP - Outlook]

Am 19 Aug 2006 18:23:42 -0700 schrieb (e-mail address removed):

John, the e-mail´s Body property contains that string.

With the InStr function you can find e.g. the start of "Billing Address" or
"Customer Name:". You then need to find the line´s end, which are usually
the vbCRLF characters. Given both the positions you can user the Mid
function to get that part of the string.
 
J

jwkolker

Thank you Michael - can you look at the rest of the problem (the call
or popup of the address book)... any code snippets to help me get
started? I just need a little nudge on this one...

Thanks.

John Kolker
 
M

Michael Bauer [MVP - Outlook]

Am 20 Aug 2006 14:50:10 -0700 schrieb (e-mail address removed):

You´ll find samples for the mentioned functions in the VBA help.

3. Adding text above:

Body = "text" & vbCRLF & Body

or below:

Body = Body & vbCRLF & "text"

4. Write into the item´s Subject property.

5. You can´t default any addresses in the Address Book. You can use
Comandbar techniques (http://www.outlookcode.com/d/tips/commandbarfun.htm)
to open it. The button´s ID is 353.

6. You can set the SaveSentMessageFolder property.
 
J

jwkolker

Again Michael thank you - what about a sample for extracting or parsing
text within the body of the email?

Have a great day.

JK
 
M

Michael Bauer [MVP - Outlook]

Am 21 Aug 2006 07:01:20 -0700 schrieb (e-mail address removed):

What is wrong with the samples from the VBA help?
 
Top