G
Gordon Rainsford
I have the following code, based on that at Ron de Bruin's site, which
creates emails exactly as required, except that the SendKeys line does
nothing. I've tried some variations of syntax, and it doesn't give an
errormessage, but it just doesn't send. Does anyone have a suggestion as
to what I'm doing wrong, or an alternative way of getting Outlook
Express to send?
Sub SendEmail()
DatabaseOpen
Set template = Workbooks("sendEmail.xls").Sheets("Sheet1")
For Each Cell In
Workbooks("ycDatabase.xls").Sheets("Database").Columns("M").Cells.Specia
lCells(xlCellTypeConstants)
If Cell.Value Like "*@*" Then
Recipient = Cell.Value
Subj = template.Range("c3").Value
msg = "Dear " & Cell.Offset(0, -10).Value & "%0A"
msg = msg & "%0A" & template.Range("c5").Value
HLink = "mailto:" & Recipient & "?"
HLink = HLink & "subject=" & Subj & "&"
HLink = HLink & "body=" & msg
ActiveWorkbook.FollowHyperlink (HLink)
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S", True
End If
Next
End Sub
creates emails exactly as required, except that the SendKeys line does
nothing. I've tried some variations of syntax, and it doesn't give an
errormessage, but it just doesn't send. Does anyone have a suggestion as
to what I'm doing wrong, or an alternative way of getting Outlook
Express to send?
Sub SendEmail()
DatabaseOpen
Set template = Workbooks("sendEmail.xls").Sheets("Sheet1")
For Each Cell In
Workbooks("ycDatabase.xls").Sheets("Database").Columns("M").Cells.Specia
lCells(xlCellTypeConstants)
If Cell.Value Like "*@*" Then
Recipient = Cell.Value
Subj = template.Range("c3").Value
msg = "Dear " & Cell.Offset(0, -10).Value & "%0A"
msg = msg & "%0A" & template.Range("c5").Value
HLink = "mailto:" & Recipient & "?"
HLink = HLink & "subject=" & Subj & "&"
HLink = HLink & "body=" & msg
ActiveWorkbook.FollowHyperlink (HLink)
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S", True
End If
Next
End Sub