Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing an Outlook message body into Access

Status
Not open for further replies.

garybug

Programmer
Jul 27, 2003
42
GB
I've got this working, but it doesn't import the whole message body, and stop after 665 characters. Do I need another data type instead of string? Code follows..

Ta much

G..

Dim sBodyContents As String

Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set NewItemsFolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("BMS").Folders("ServiceDevelopment")
Set ProcessedItemsFolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("BMS").Folders("ServiceDevelopment").Folders("Processed")

'Get latest email data
If NewItemsFolder.Items.Count = 0 Then
MsgBox "No New Emails"
Else
For iCount = 1 To NewItemsFolder.Items.Count
sBodyContents = NewItemsFolder.Items(iCount).Body
MsgBox Len(varBodyContents)
NewItemsFolder.Items(iCount).Move ProcessedItemsFolder
Next
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top