Looping Through and Exporting Outlook 2003 Messages

G

Gwhit

Hello,

I'm looking for a point in the right direction with regard to referencing
email messages (using VBA) located under the Personal Folders directory of my
Outlook 2003 in a folder named "WSN", then
1. Looping through each email message located in the folder, (each message
identically formatted as shown below) then
2. Exporting the collection of emails into a single text file.

I'm aware that parsing and extracting will be quite necessary but I'm just
trying to establish a correct starting point.


I have purchased and perused the Microsoft Outlook Programming book and have
found helpful info but I am likely overlooking my specific answer somehow.
Thank you in advance. Here is a sample of the email structure (real data
replaced with silly data):


DEWEY, CHEATHAM AND HOWE
ACME CUSTOMER ORDER

Order Date: 10/10/2005

Order Status: Autoship (Acme Info Only) – Category: Doughnuts

BILL TO INFORMATION
SHIP TO
INFORMATION
Name: Arnold Flipdiddle Name:
Address: 1313 Mockingbird Ln Address:
City: Downtown State: CA Zip: 99999 City: State: Zip:
Country: U.S.A. Country:

Phone: (777)555-5555 SHIP METHOD: U.S.
Priority Mail

CREDIT CARD INFO: TOTAL ORDER INFO:
Name on Card: Arnold Flipdiddle SubTotal: 8.50
Method of Pymt: RECOVER Tax:
Cred Card #: 1234543212345432 S & H: 3.00
Exp Date: 0906 TOTAL: 11.50
CVV/CVC: 222

ORDER INFORMATION: ORDER INFORMATION CONTINUED:
Item 1: Bear Claw Item 4:
Qty 1: 10 Qty 4:
Price 1: .50 Price 4:
Total 1: 5.00 Total 4: .00

Item 2: Long John Item 5:
Qty 2: 10 Qty 5:
Price 2: .35 Price 5:
Total 2: 3.50 Total 5: .00

Item 3: Item 6:
Qty 3: Qty 6:
Price 3: Price 6:
Total 3: .00 Total 6: .00


SPECIAL NOTES:
 
M

Michael Bauer [MVP - Outlook]

Am Thu, 12 Oct 2006 19:43:01 -0700 schrieb Gwhit:

Dim obj as Object
Dim Folder as OUtlook.Mapifolder
Dim Items as Outlook.Items
Dim Buffer as String

set Folder=Application.Session.Pickfolder
If Folder is Nothing Then Exit Sub
Set Items=Folder.Items
For Each obj in Items
Buffer = Buffer & obj.Body & vbCRLF
Next

Now all the contents are in the variable Buffer. Here´s a sampel for how to
write that string into a file:
http://www.vboffice.net/sample.html?mnu=1&smp=14&cmd=showitem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top