0

I was passing a string of HTML formatted text for a signature in VB6 to Outlook but on certain very old computers with very old versions of outlook it was running into a problem where hypens would start a new line, or if I used the tag to fix it then word wrap would be totally turned off.

I want to try to use RTF instead hoping that this will fix the problem. However I still have that signature that is in HTML and I need to pass it in as a string into Outlook using Rich Text formatting. I can't find any good resources on this or if it is even possible, whenever I try they show up with the escape commands and everything.

My current HTML string:

string = vbCrLf & vbCrLf & "<B><FONT face=Arial color=#365f91 size=2>" & _
                        strName & "</FONT>" & _
                        "<FONT face=Arial size=2><BR>" & _
                        "<I>" & strPosition & "</I>" & _
                        "</FONT></B><BR/><B><FONT face=Arial size=2>" & _
                        strAddress1 & "</FONT></B><BR/><FONT face=Arial size=1>" & _
                        strAddress2 & "<BR>" & strCity & ", " & _
                        strProvince & ", " & strPostalCode & _
                        "<BR>" & strCountry & "<BR>Office: " & strPhone & _
                        "<BR>" & strEmail & "<BR>www.website.com<BR>" & _
                        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & _
                        "<I><FONT face=Arial size=2>" & strImageCaption & "</FONT>" & _
                        "<BR/><BR/><BR/></I><FONT face=Arial size=1>" & strDisclaimer & _
                        "</FONT></P>"

Anyone able to help me pass this in as rtf or know of anyway I could do this? Will be very appreciated!

EDIT: Alternatively if anyone knows how to fix the issue with word-wrap/line-breaking hyphens I would love that too.

Loogawa
  • 389
  • 6
  • 24
  • 1
    For the non-breaking hyphen you could try replacing it with ‑ as stated here: http://stackoverflow.com/questions/7691569/no-line-break-after-a-hyphen For the RTF stuff: why don't you layout what you need in WordPad and save the file as RTF, then open the RTF file in notepad (or notepad++) to see the actual markup. For help on RTF see the [specs](http://msdn.microsoft.com/en-us/library/office/aa140277(v=office.10).aspx) – rene Feb 23 '13 at 10:01

1 Answers1

3

This can be the RTF template idea, produced by wordpad and slightly altered. I assume you can mixin the VB stuff to replace the variable text.

To get this:
Hello
postion
My‑street
Mystreet 2
My city
My disclaimer

( I don't how to do color in SO markup but in the RTF the first line in RED and My disclaimer is one point smaller)

use this RTF:

{\rtf1\ansi\ansicpg1252\deff0\deflang1043{\fonttbl{\f0\fnil\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
\cf0\b\fs22 Hello\par
\cf0\b0\i\fs24 postion\par
\i0 My\_street\par
Mystreet 2\par
My city\par
\fs22 My disclaimer\par
\f1\par
}

between My and street I placed a non breaking hyphen, according to the RTF specs. In html the same could be achieved by using

&#8209;
rene
  • 41,474
  • 78
  • 114
  • 152
  • 1
    The problem is that the user enters the hypen, not programmatically. – Loogawa Feb 25 '13 at 13:38
  • I don't understand. Educate the user that they can use a non-breaking hypen? Or do they enter some free text and then is it your task to convert that in a standarized way? – rene Feb 25 '13 at 16:48
  • I attempted the non-breaking hyphen used by ctrl+shift+hyphen. Sadly they're running through a remote system or something in which this doesn't work. I was able to fix the problem by rearranging my tags and doing something with the

    tag that I thought I had already tried but eventually it just worked.

    – Loogawa Feb 27 '13 at 17:49