Inserting a carriage return (paragraph mark)

P

Paul

In my old days working with Quick Basic, you could insert
a CR-LF into a chr() function. The chr() function is
still there in VBA, but I cant find a list of codes for
these types of "characters". Does anybody know what the
code is for this?

What I want to do is to insert an extra paragraph based on
a user selection, but I don't want the extra white space
if their selection results in no added text.
 
P

Paul

-----Original Message-----
In my old days working with Quick Basic, you could insert
a CR-LF into a chr() function. The chr() function is
still there in VBA, but I cant find a list of codes for
these types of "characters". Does anybody know what the
code is for this?

What I want to do is to insert an extra paragraph based on
a user selection, but I don't want the extra white space
if their selection results in no added text.
.
Never mind, I found it -- its in the small print at the
bottom of the character chart -- chr(13) returns a
carriage return, in case anyone needs to know.
 
J

Jay Freedman

Hi, Paul,

Although it's sometimes useful to know that a paragraph mark is Chr(13), VBA
has a selection of constants for these things. A paragraph mark is vbCr, and
a tab character is vbTab (aka Chr(9)). The Selection object also has methods
named Selection.InsertParagraphBefore and Selection.InsertParagraphAfter
that may be useful.

But if you just want white space between paragraphs, you shouldn't be
inserting empty paragraphs. Instead, adjust the SpaceAfter property of the
paragraph before the space, or the SpaceBefore property of the paragraph
that follows it. Even better would be to define styles with the proper
SpaceBefore/SpaceAfter values and apply those styles appropriately.

The only time I would recommend using paragraph marks for spacing is when
the text will be exported to another program that doesn't format text the
way Word does.
 

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