> Why is it inserting a blank space in front of the second line?? Thanks.
>I have a multi line text box on a userform as an address field. The user
> would enter the address as:
[quoted text clipped - 9 lines]
>
> Why is it inserting a blank space in front of the second line?? Thanks.
I've tried using vbCr, vbCrLf, chr(13), chr(10), nothing seems to work.
Here's the code:
With cboHOName
If cboHOName.Value = "Baltimore" Then
txtAddress.Text = "1000 Park Avenue, Suite 500" & vbCrLf &
"Baltimore, MD 21201"
ElseIf cboHOName.Value = "Charleston" Then
txtAddress.Text = "1000 Quarrier Street, Suite 500" & vbCr &
"Charleston, WV 25301"
End If
End With
No matter what I use, I still end up with something the blank space in the
document in front of the 2nd line of the address.
1000 Quarrier Street, Suite 500
Charleston, WV 25301
> > Why is it inserting a blank space in front of the second line?? Thanks.
>
[quoted text clipped - 22 lines]
> >
> > Why is it inserting a blank space in front of the second line?? Thanks.
Peter Jamieson - 30 Nov 2006 09:19 GMT
Sorry, I've been away.
<aybe you found the answer elsewhere. If not,
a. when I use your code to /populate/ my text box, there is no extra space
at the beginning of the line (e.g. when using vbCrLf.
b. it's when you get that text back and put it into a document variable
that the problem starts (or indeed, you would have the same problem if you
set your document variable text to the string with vbCrLf in it). In other
words, the text box is always giving you a vbCrLf back regardless of what
line end characters you use
c. so you need to process the string you get back from the text box before
you assign it to the document variable, e.g. use something like
ActiveDocument.Variables.Add Name:="myvariable",
Value:=Replace(TextBox1.Text, vbCrLf, vbCr)
Peter Jamieson
> I've tried using vbCr, vbCrLf, chr(13), chr(10), nothing seems to work.
> Here's the code:
[quoted text clipped - 48 lines]
>> > Why is it inserting a blank space in front of the second line??
>> > Thanks.