Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: How to align a text in an email

Geek News

How to align a text in an email
"ielmrani via AccessMonster.com" <u21259[ at ]uwe> 12/9/2008 3:04:49 PM
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

--
Message posted via http://www.accessmonster.com

Re: How to align a text in an email
Stefan Hoffmann <ste5an[ at ]ste5an.de> 12/9/2008 3:13:55 PM
hi,

ielmrani via AccessMonster.com wrote:
[Quoted Text]
> .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 <--
Re: How to align a text in an email
"Stuart McCall" <smccall[ at ]myunrealbox.com> 12/9/2008 4:32:05 PM

"ielmrani via AccessMonster.com" <u21259[ at ]uwe> wrote in message
news:8e689b139305c[ at ]uwe...
[Quoted Text]
> 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.


Re: How to align a text in an email
"ielmrani via AccessMonster.com" <u21259[ at ]uwe> 12/9/2008 5:05:43 PM
I am not sure how to do that. Can you help. Thanks

Stefan Hoffmann wrote:
[Quoted Text]
>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 <--

--
Message posted via http://www.accessmonster.com

Re: How to align a text in an email
"ielmrani via AccessMonster.com" <u21259[ at ]uwe> 12/9/2008 5:22:33 PM
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 McCall wrote:
[Quoted Text]
>> 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.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Re: How to align a text in an email
"ielmrani via AccessMonster.com" <u21259[ at ]uwe> 12/9/2008 5:56:54 PM
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>"

ielmrani wrote:
[Quoted Text]
>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>
>
>>> Hi,
>>> First of all thank you so much in advance.
>[quoted text clipped - 7 lines]
>>
>>IOW use HTML markup instead of spaces and carriage returns.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200812/1

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net