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 (e-mail address removed) (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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top