| 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 |