Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paragraph Mark

Status
Not open for further replies.

MrSR

Instructor
Jan 23, 2002
39
US
I am searching for text in a document and saving it to a string variable. I do a find and replace for a key word, once found i move one character to the right to deselect the selection, then i move down one paragraph and highlight. works beautifully, however if there is no text there it selects the paragraph mark. The string variable and then used as default text in a userform text box. The problem i am having is determining whether the string variable is a paragraph mark because if is i want the variable to return a blank so the paragraph mark does not show up in the text box.
 
i tried Len(trim(selection.text)) = 0 but that does not work.
 
i got it.
If Asc(selection.text) = 13 then
string = ""
else
string = selection.text
end if
 
Try also looking up Collapse in Help. This collapses the Selection (either to the Start, or End).

Also9 lok up Ranges in help, as this may speed up your process.

Better yet - use styles and never have those "empty" paragraph marks ever again.

Gerry
 
I haven't tested it but can you simply search for the paragraph mark or replace it by a space or blank?

replace(mystring,chr(13),"")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top