B
Bob Leffew
I have successfully been able to read my "Sent" messages to write out to an
Access database.
Problem is I want to be able to extract specific email addresses instead of
having to read the whole data base.
The problem I am having is that in my statement (as shown below in my code)
If LCase$(thismessage.To) <> LCase(txtEmailAddress.text) Then GoTo
NotAMatch
thismessage.To is not always the actual email address. What I seem to have
figured out is there is a way to get to the actual email address by using
oRecip. But I cant seem to figure it out. Can someone point me in the
right direction.
I understand you need to Set ORecip and Dim it but not sure how.
Thanks,
Bob Leffew
Set OLApp = CreateObject("Outlook.Application.11")
Set OLFolders = OLApp.GetNamespace("Mapi")
Set OLSentItems =
OLFolders.GetDefaultFolder(olFolderSentMail).Items
Set rsEmail = New ADODB.Recordset
rsEmail.CursorLocation = adUseClient
rsEmail.MaxRecords = 1
rsEmail.Open "Select * From EmailsBobSent",
modMakeConnectionSGI.cnSGI, adOpenDynamic, adLockOptimistic
PopGridSent:
countrecords = 0
For Each thismessage In OLSentItems
sAdr = LCase$(txtEmail1.Text)
If LCase$(thismessage.To) <> LCase(txtEmailAddress.text)
Then GoTo NotAMatch
rsEmail.AddNew
rsEmail!EmailSentTo = CStr(thismessage.To)
rsEmail!EmailSentOn = thismessage.SentOn
rsEmail!EmailSubject = thismessage.Subject
rsEmail!EmailBody = thismessage.Body
rsEmail.Update
NotAMatchSent:
Next
EndThisSubsent:
rsEmail.Requery
Access database.
Problem is I want to be able to extract specific email addresses instead of
having to read the whole data base.
The problem I am having is that in my statement (as shown below in my code)
If LCase$(thismessage.To) <> LCase(txtEmailAddress.text) Then GoTo
NotAMatch
thismessage.To is not always the actual email address. What I seem to have
figured out is there is a way to get to the actual email address by using
oRecip. But I cant seem to figure it out. Can someone point me in the
right direction.
I understand you need to Set ORecip and Dim it but not sure how.
Thanks,
Bob Leffew
Set OLApp = CreateObject("Outlook.Application.11")
Set OLFolders = OLApp.GetNamespace("Mapi")
Set OLSentItems =
OLFolders.GetDefaultFolder(olFolderSentMail).Items
Set rsEmail = New ADODB.Recordset
rsEmail.CursorLocation = adUseClient
rsEmail.MaxRecords = 1
rsEmail.Open "Select * From EmailsBobSent",
modMakeConnectionSGI.cnSGI, adOpenDynamic, adLockOptimistic
PopGridSent:
countrecords = 0
For Each thismessage In OLSentItems
sAdr = LCase$(txtEmail1.Text)
If LCase$(thismessage.To) <> LCase(txtEmailAddress.text)
Then GoTo NotAMatch
rsEmail.AddNew
rsEmail!EmailSentTo = CStr(thismessage.To)
rsEmail!EmailSentOn = thismessage.SentOn
rsEmail!EmailSubject = thismessage.Subject
rsEmail!EmailBody = thismessage.Body
rsEmail.Update
NotAMatchSent:
Next
EndThisSubsent:
rsEmail.Requery