Paragraph mark in string?

B

Bob

Is there any way to indicate the presence of a paragraph
mark in a string, or precedes a string?

For instance, I want to say something like

If Selection.Text = "Text" Then
' do something

I would like to test wether or not there is a paragraph
before the "text", as in here

If Selection.Text = ParagraphMark, "Text" Then
' do something

Is there any way to do something like this? The problem
is that I am dealing with tables of contents, and when I

..TablesOfContents(1).Range.Select

the paragraph mark above the table of contents (which was
just updated) is "included" in the table of contents
field, so that the table of contents cannot be selected
without also selecting the paragraph mark, and so .Text
will never = "Text" because there is a paragraph mark
included in the selection.

Thaks for any help
 
G

Guest

Can't get it to work. Also found out that Chr(182) stands
for the paragraph character. But what do I do with it?
Put inside quote

If Selection.Text = "Chr(182)Text" Then

or outside?


If Selection.Text = Chr(182)& "Text" Then

Neither works. Any ideas? Am I way off?
 
K

Klaus Linke

Hi Bob,
Also found out that Chr(182) stands for the
paragraph character. But what do I do with it?

Chr(182) is the paragraph sign, ¶.
The paragraph mark is Chr(13) if you got the string from a Word doc.

You can use
MsgBox Instr(1,Selection.Text,Chr(13) & "Text")
If the selection doesn't contain that string, you get zero, else you get
the starting position.

Greetings,
Klaus
 
H

Howard Kaikow

182 is the pilcrow, which looks like Word's "paragraph mark:, but a
"paragraph mark" is not a character, it is a special sequence of bytes.
 

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