Inserting text with carraige returns

M

Mike Perlini

Hi,

I have an application that takes input and globally finds and replaces
codes within a document with the input. The problem is that some of
the input is multi-line strings (i.e. containing \r\n). When I insert
this string, I want it to insert as multiple lines, but it actually
inserts a 'box' symbol in for the \r\n, so the inserted string would
be:

The quick brown fox¿¿jumped over the lazy dog (but with ¿ actually a
hollow box)

rather than

The quick brown fox
jumped over the lazy dog

Can anyone help??

Thanks heaps!

Mike
 
S

Steve Yandl

Try using vbCrLf to give the line break. For example

myStr = "This is" & vbCrLf & "a test"

Selection.TypeText(myStr) should give

This is
a test

Steve
 
W

Word Heretic

G'day [email protected] (Mike Perlini),

..InsertParagraph etc is the safest way.

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: Steve at wordheretic.com


Mike Perlini was spinning this yarn:
Hi,

I have an application that takes input and globally finds and replaces
codes within a document with the input. The problem is that some of
the input is multi-line strings (i.e. containing \r\n). When I insert
this string, I want it to insert as multiple lines, but it actually
inserts a 'box' symbol in for the \r\n, so the inserted string would
be:

The quick brown fox¿¿jumped over the lazy dog (but with ¿ actually a
hollow box)

rather than

The quick brown fox
jumped over the lazy dog

Can anyone help??

Thanks heaps!

Mike

Steve Hudson

Word Heretic, Sydney, Australia

wordheretic.com

If answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 
Top