469,352 Members | 2,150 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Formatting a HtmlBody email string to include variables

I have this:
1 emailBody = "<html>" & vbCrLf _
2 & "<head>" & vbCrLf _
3 & "<title>Interpreter Request details</title> " &
vbCrLf _
4 & "</head> " & vbCrLf _
5 & "<body> " & vbCrLf _
6 & "<font face=Verdana><b>Interpreter Request
details: " & vbCrLf _
7 & "Requestor: </b><u> <% strFName strLName %></u>"
& vbCrLf _
...
& "</body> " & vbCrLf _
& "</html> " & vbCrLf

In line 7, I need to display the results of the variables strFName and
strLName (and have a space in between the two) but I don't know the proper
formatting. If I just use the & then I get the literal strFname instead of
the value. Could someone please show me the correct syntax for this?

TIA!
Oct 13 '05 #1
5 3356

Tom Petersen wrote:
I have this:
1 emailBody = "<html>" & vbCrLf _
2 & "<head>" & vbCrLf _
3 & "<title>Interpreter Request details</title> " &
vbCrLf _
4 & "</head> " & vbCrLf _
5 & "<body> " & vbCrLf _
6 & "<font face=Verdana><b>Interpreter Request
details: " & vbCrLf _
7 & "Requestor: </b><u> <% strFName strLName %></u>"
& vbCrLf _
...
& "</body> " & vbCrLf _
& "</html> " & vbCrLf

In line 7, I need to display the results of the variables strFName and
strLName (and have a space in between the two) but I don't know the proper
formatting. If I just use the & then I get the literal strFname instead of
the value. Could someone please show me the correct syntax for this?

TIA!


Line 7: & "Requestor: </b><u>" & strFName & " " & strLName & "</u>"
& vbCrLf _

assuming you want a space between strFName and strLName

Paxton

Oct 13 '05 #2
That worked great, what a pain! Thanks!

One last thing, my vbCrLf doesn't seem to work, isn't that supposed to be a
carriage return? Everthing is on the same line and I need it to have an
'enter' after some of the lines...
"Paxton" <pa*******@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...

Tom Petersen wrote:
I have this:
1 emailBody = "<html>" & vbCrLf _
2 & "<head>" & vbCrLf _
3 & "<title>Interpreter Request details</title> " &
vbCrLf _
4 & "</head> " & vbCrLf _
5 & "<body> " & vbCrLf _
6 & "<font face=Verdana><b>Interpreter Request
details: " & vbCrLf _
7 & "Requestor: </b><u> <% strFName strLName
%></u>"
& vbCrLf _
...
& "</body> " & vbCrLf _
& "</html> " & vbCrLf

In line 7, I need to display the results of the variables strFName and
strLName (and have a space in between the two) but I don't know the
proper
formatting. If I just use the & then I get the literal strFname instead
of
the value. Could someone please show me the correct syntax for this?

TIA!


Line 7: & "Requestor: </b><u>" & strFName & " " & strLName & "</u>"
& vbCrLf _

assuming you want a space between strFName and strLName

Paxton

Oct 13 '05 #3
VbCrLf is for line breaks in text emails. <br> does it in html.

So line 6 and 7 should look like this:

6 & "<font face=Verdana><b>Interpreter Request details: <br>" & _
7 & "Requestor: </b><u>" & strFName & " " & strLName & </u><br>" & _
etc....

Paxton

Tom Petersen wrote:
That worked great, what a pain! Thanks!

One last thing, my vbCrLf doesn't seem to work, isn't that supposed to be a
carriage return? Everthing is on the same line and I need it to have an
'enter' after some of the lines...
"Paxton" <pa*******@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...

Tom Petersen wrote:
I have this:
1 emailBody = "<html>" & vbCrLf _
2 & "<head>" & vbCrLf _
3 & "<title>Interpreter Request details</title> " &
vbCrLf _
4 & "</head> " & vbCrLf _
5 & "<body> " & vbCrLf _
6 & "<font face=Verdana><b>Interpreter Request
details: " & vbCrLf _
7 & "Requestor: </b><u> <% strFName strLName
%></u>"
& vbCrLf _
...
& "</body> " & vbCrLf _
& "</html> " & vbCrLf

In line 7, I need to display the results of the variables strFName and
strLName (and have a space in between the two) but I don't know the
proper
formatting. If I just use the & then I get the literal strFname instead
of
the value. Could someone please show me the correct syntax for this?

TIA!


Line 7: & "Requestor: </b><u>" & strFName & " " & strLName & "</u>"
& vbCrLf _

assuming you want a space between strFName and strLName

Paxton


Oct 13 '05 #4
"Tom Petersen" <to**********@sdsd.sdbor.edu> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl...
I have this:
1 emailBody = "<html>" & vbCrLf _ .. . . In line 7, I need to display the results of the variables strFName
and strLName (and have a space in between the two) but I don't
know the proper formatting.


Remember, all you're doing is building up a String that "just happens"
to have HTML in it.

emailBody = "<html>" & vbCrLf _
. . .
& "<body>" & vbCrLf _
& "<font face=Verdana>"
& <b>Interpreter Request details: " & "<br>" & vbCrLf _
& "Requestor: </b><u>" _
& strFName & " " & strLName _
& "</u>" & "<br>" & vbCrLf _
. . .
& "</body> " & vbCrLf _
& "</html> " & vbCrLf

Note the use of "<br>" & vbCrLf to force an HTML-style line
break - HTML does not care about white-space; only HTML tags.

HTH,
Phill W.
Oct 13 '05 #5
just call me Homer Simpson! I knew that! Thanks for all of the help!!!

"Paxton" <pa*******@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
VbCrLf is for line breaks in text emails. <br> does it in html.

So line 6 and 7 should look like this:

6 & "<font face=Verdana><b>Interpreter Request details: <br>" & _
7 & "Requestor: </b><u>" & strFName & " " & strLName & </u><br>" & _
etc....

Paxton

Tom Petersen wrote:
That worked great, what a pain! Thanks!

One last thing, my vbCrLf doesn't seem to work, isn't that supposed to be
a
carriage return? Everthing is on the same line and I need it to have an
'enter' after some of the lines...
"Paxton" <pa*******@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
>
> Tom Petersen wrote:
>> I have this:
>> 1 emailBody = "<html>" & vbCrLf _
>> 2 & "<head>" & vbCrLf _
>> 3 & "<title>Interpreter Request details</title>
>> " &
>> vbCrLf _
>> 4 & "</head> " & vbCrLf _
>> 5 & "<body> " & vbCrLf _
>> 6 & "<font face=Verdana><b>Interpreter Request
>> details: " & vbCrLf _
>> 7 & "Requestor: </b><u> <% strFName strLName
>> %></u>"
>> & vbCrLf _
>> ...
>> & "</body> " & vbCrLf _
>> & "</html> " & vbCrLf
>>
>> In line 7, I need to display the results of the variables strFName and
>> strLName (and have a space in between the two) but I don't know the
>> proper
>> formatting. If I just use the & then I get the literal strFname
>> instead
>> of
>> the value. Could someone please show me the correct syntax for this?
>>
>> TIA!
>
> Line 7: & "Requestor: </b><u>" & strFName & " " & strLName & "</u>"
> & vbCrLf _
>
> assuming you want a space between strFName and strLName
>
> Paxton
>

Oct 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by frizzle | last post: by
5 posts views Thread by luke | last post: by
1 post views Thread by JohnE | last post: by
8 posts views Thread by Arjen | last post: by
1 post views Thread by Joe Fallon | last post: by
6 posts views Thread by brian_harris | last post: by
2 posts views Thread by xlar54 | last post: by
2 posts views Thread by Alan Bak | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.