I
ielmrani via AccessMonster.com
Hi,
First of all thank you so much in advance.
I am doing a mass mailing using access 2003.
I have this code which works great. When the email is sent the .HTMLBody
appears in one line. I want the email body to appear like the following:
Center the first line "The Next......"
Leave a blank line
Center the second line "Market Downturn......"
Center the third line. "Will Combine to Wreak Havoc in 2009"
Here is the piece that needs to be fixed:
I tried something that did not work.
HTMLBody = "The Next......" & vbCrLf _
& Space(50) & "Market Downturn......" & vbCrLf _
& Space(55) & "Will Combine to Wreak Havoc in 2009"
Attachments.Add "C:\Documents\Insights.pdf", olByValue, , "Stuff"
The full code:
Private Sub Command0_Click()
Dim db As Database
Dim rs As DAO.Recordset
Dim strTO As String
'Dont't forget to reference the Outlook Object Library
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
Set db = CurrentDb
'Only select records with an email address
Set rs = db.OpenRecordset("SELECT Email FROM Table1 WHERE Trim(Email & '')
<>''")
Do Until rs.EOF
If strTO = "" Then
strTO = rs!Email
Else
strTO = strTO & "; " & rs!Email
End If
rs.MoveNext
Loop
With objEmail
BCC = strTO
Subject = "New"
HTMLBody = "The Next......" & vbCrLf _
& Space(50) & "Market Downturn......" & vbCrLf _
& Space(55) & "Will Combine to Wreak Havoc in 2009"
Attachments.Add "C:\Documents\Insights.pdf", olByValue, , "Stuff"
'.Display
Send
End With
Beep
MsgBox "Email Sent to recipients", vbOKOnly, "Done"
End Sub
First of all thank you so much in advance.
I am doing a mass mailing using access 2003.
I have this code which works great. When the email is sent the .HTMLBody
appears in one line. I want the email body to appear like the following:
Center the first line "The Next......"
Leave a blank line
Center the second line "Market Downturn......"
Center the third line. "Will Combine to Wreak Havoc in 2009"
Here is the piece that needs to be fixed:
I tried something that did not work.
HTMLBody = "The Next......" & vbCrLf _
& Space(50) & "Market Downturn......" & vbCrLf _
& Space(55) & "Will Combine to Wreak Havoc in 2009"
Attachments.Add "C:\Documents\Insights.pdf", olByValue, , "Stuff"
The full code:
Private Sub Command0_Click()
Dim db As Database
Dim rs As DAO.Recordset
Dim strTO As String
'Dont't forget to reference the Outlook Object Library
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
Set db = CurrentDb
'Only select records with an email address
Set rs = db.OpenRecordset("SELECT Email FROM Table1 WHERE Trim(Email & '')
<>''")
Do Until rs.EOF
If strTO = "" Then
strTO = rs!Email
Else
strTO = strTO & "; " & rs!Email
End If
rs.MoveNext
Loop
With objEmail
BCC = strTO
Subject = "New"
HTMLBody = "The Next......" & vbCrLf _
& Space(50) & "Market Downturn......" & vbCrLf _
& Space(55) & "Will Combine to Wreak Havoc in 2009"
Attachments.Add "C:\Documents\Insights.pdf", olByValue, , "Stuff"
'.Display
Send
End With
Beep
MsgBox "Email Sent to recipients", vbOKOnly, "Done"
End Sub