Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Formatting a HtmlBody email string to include variables

Reply
Thread Tools

Formatting a HtmlBody email string to include variables

 
 
Tom Petersen
Guest
Posts: n/a
 
      10-13-2005
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!


 
Reply With Quote
 
 
 
 
Paxton
Guest
Posts: n/a
 
      10-13-2005

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

 
Reply With Quote
 
 
 
 
Tom Petersen
Guest
Posts: n/a
 
      10-13-2005
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" <> wrote in message
news: 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
>



 
Reply With Quote
 
Phill. W
Guest
Posts: n/a
 
      10-13-2005
"Tom Petersen" <> wrote in message
news:eo6omb$...
> 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.


 
Reply With Quote
 
Paxton
Guest
Posts: n/a
 
      10-13-2005
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" <> wrote in message
> news: 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
> >


 
Reply With Quote
 
Tom Petersen
Guest
Posts: n/a
 
      10-13-2005
just call me Homer Simpson! I knew that! Thanks for all of the help!!!

"Paxton" <> wrote in message
news: 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" <> wrote in message
>> news: 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
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
new string formatting with local variables Jabba Laci Python 4 06-06-2011 09:07 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
HTMLBody and variable Serge Myrand ASP General 6 08-10-2004 10:49 AM
Global variables - application variables vs include file mark4asp ASP General 1 09-03-2003 01:30 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments