Darren DICK
d.dick at uws.edu.au
Wed Mar 16 23:22:45 CST 2005
Hi all
2nd Posting
I have now wasted a total of 6 and a half hours on this
It can't be that difficult - surely
Can someone please help?
Code below modified from my previous post
I have references to Outlook 11
I have references to Redemption
All that side of things is OK
I can send up to 2 emails before the code chokes
The email addresses are real, they work
All I want this thing to do is
Create the message then send it - loop the recordset then
Create the message then send it - loop the recordset then...
Simple <sigh>
Many thanks
Darren
<Code>
Dim db As DAO.Database
Dim selSQL As String
Dim rs As DAO.Recordset
Dim gappOutlook As New Outlook.Application
Dim omsg
Dim msg
Set db = CurrentDb()
selSQL = "Select tmp_tblEmailAddresses.* from tmp_tblEmailAddresses"
Set rs = db.OpenRecordset(selSQL, dbOpenSnapshot)
Set omsg = gappOutlook.CreateItem(olMailItem)
Set msg = New Redemption.SafeMailItem
msg.Item = omsg
With rs
Do While Not .EOF
With msg
.To = rs!EmailAddress
.cc = Me.txtCC
.bcc = Me.txtBCC
.Subject = Me.txtSubject
.Attachments.Add Me.txtATTACH
.Body = Me.txtBody
'.Display ' shows it in the email client before sending
.Send
End With
.MoveNext
Loop
End With
</Code>