Connecting Tech Pros Worldwide Help | Site Map

Email Message within MS Access

Drum2001
Guest
 
Posts: n/a
#1: Nov 13 '06
I have a database that strips an attachment from an MS Outlook e-mail
and saves it to a designated folder. Is there any way to save the
actual message itself?

Ron2006
Guest
 
Posts: n/a
#2: Nov 14 '06

re: Email Message within MS Access


Yes there is. The trick is figuring out which email to save. The
following routine is looking through the sent folder for a certain
email and then saving it. You will have to take it from there and
modify to fit your requirements - different folder and how to identify
which one.

========================================

Set olApp = CreateObject("Outlook.Application")
Set oLMapi = olApp.GetNamespace("MAPI")
Set olF = oLMapi.GetDefaultFolder(olFolderSentMail)
Set olIt = olF.Items
' Set olItems = oLMapi.GetDefaultFolder(olFolderSentMail).Items


For Each m In olIt

' ' If m.Subject = hldSubject Then ' was used
but not now.

If InStr(1, m.Body, hldTimeStamp) 0 Then
wrkSubject = m.Subject
wrkSubject = Replace(wrkSubject, ":", " ")
wrkSubject = Replace(wrkSubject, "/", " ")
saveasname = newsubdir & wrkSubject & " - TmStmp-" &
curdate & ".msg"
m.SaveAs (saveasname)
ordersaved = 1
GoTo getoutofemail
End If
Next m

getoutofemail:

Ron

Closed Thread