How to align a text in an email

  • Thread starter ielmrani via AccessMonster.com
  • Start date
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
 
S

Stefan Hoffmann

hi,
.HTMLBody = "The Next......" & vbCrLf _
& Space(50) & "Market Downturn......" & vbCrLf _
& Space(55) & "Will Combine to Wreak Havoc in 2009"
You should consider using HTML instead of plain text.


mfG
--> stefan <--
 
S

Stuart McCall

ielmrani via AccessMonster.com said:
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"
<snip>

<center>"The Next......"<br><br>"Market Downturn......"<br>"Will Combine to
Wreak Havoc in 2009"</center>

IOW use HTML markup instead of spaces and carriage returns.
 
I

ielmrani via AccessMonster.com

thank you.

I did this but I am getting the word false in my email

HTMLBody = "The Next ..." < br <> br > "Market ......" < br > "Will Combine
to Wreak Havoc in 2009"

I won't accept the <center>

Stuart said:
Hi,
First of all thank you so much in advance.
[quoted text clipped - 8 lines]
Center the second line "Market Downturn......"
Center the third line. "Will Combine to Wreak Havoc in 2009"
<snip>

<center>"The Next......"<br><br>"Market Downturn......"<br>"Will Combine to
Wreak Havoc in 2009"</center>

IOW use HTML markup instead of spaces and carriage returns.
 
I

ielmrani via AccessMonster.com

I made work. Thank you so much for your help.

this is what I did.

HTMLBody = "<HTML><BODY><center> The Next ..... <center> Market Downturn..
<center> Will Combine to Wreak Havoc in 2009 </BODY></HTML>"
thank you.

I did this but I am getting the word false in my email

.HTMLBody = "The Next ..." < br <> br > "Market ......" < br > "Will Combine
to Wreak Havoc in 2009"

[quoted text clipped - 7 lines]
IOW use HTML markup instead of spaces and carriage returns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top