UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> .htmlbody problem with tags    
 
   
golsen
post Feb 11 2005, 11:44 AM
Post #1

UtterAccess Addict
Posts: 270
From: USA



Hi everyone,

Since my hyperlinks that I am sending from my Access application is cutting off, I am sending of the email message using .htmlbody instead of the .body.
However, I am experiencing a problem. Once the users types in information in the txtMessage box and hit the enter key (to get spacing between the lines), it is not recognized in the .htmlbody. So, I need to put in that it adds a either

and

or just a
break every time they hit the enter key.

So, I tried to use the KeyPress event and write that:
If KeyAscii = 13 Then
Me.txtMessage = Me.txtMessage & vbCrLf & "
"
Else
Me.txtMessage = Me.txtMessage
End If

However, that doesn't work. Does anyone know a solution for this?

Any help would be appreciated!

Geir
Go to the top of the page
 
+
Fletch
post Feb 13 2005, 09:57 AM
Post #2

UtterAccess Ruler
Posts: 2,329
From: Northern Virginia, USA



Yes, I think I can help. In HTML, vbNewLine is not recognized (that is, Chr's 13 and 10). So, you need to use HTML tags to create a space. Probably the most straightforward way is to create a <BR> tag, though depending on what you're doing you could consider the paragraph tag <P> with optional </P> end tag.

What I did when I needed to do something similar to what you're doing is just use the Replace function. So, I let the user type in whatever they want without modifying it--in your case in txtMessage it sounds like.

Then, I would do something like

olMessage.HTMLBody = Replace(txtMessage.Value, vbNewLine, "<BR>")

Also consider that if you have more than one space in a row that it will also be lost when you convert to HTML. So, if that's important to you, you'll need to replace spaces with the HTML non-breaking space character which is simply "&nbsp;" without the quotes.

Hope that helps! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+
golsen
post Feb 17 2005, 07:13 AM
Post #3

UtterAccess Addict
Posts: 270
From: USA



That helps!

Thank you so much.

Geir
Go to the top of the page
 
+
Fletch
post Feb 17 2005, 08:27 AM
Post #4

UtterAccess Ruler
Posts: 2,329
From: Northern Virginia, USA



Great, glad to help! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 08:02 AM