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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking for non-printing characters 1

Status
Not open for further replies.

tyhand

Programmer
Jul 3, 2002
186
US
Hi all,

How do I check to see if I have non-printing characters in a range? Particularly paragraph marks.

I'm iterating through a range using ActivDoc.Range.Paragraphs.Words (VBA on MS Word).

It turns out that every single paragraph mark (which are supposed to be invisible) is being read. As a result, my code doesn't function properly.

I'm attempting to check for the paragraph marks using IF statements on several of the paragraph properties, but nothing seems to work. Any help is appreciated. Thanx. Peace!
 
I think your looking for vbCr. Here's an example.

Set myrange = ActiveDocument.Range(Start:=0, End:=Selection.End)
For Each singleWord In myrange.Words
If singleWord = vbCr Then
MsgBox ("found one")
End If
Next singleWord
 
hey sfvb,

Didn't find a vbCr, but i found a vb Chr function that checks for ascii character. Incidentally, the help files mentions that chr(10) returns a line feed and chr(13) a paragraph mark. I tested the Chr(13) and it works fine.
Thanks for the help. Peace!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top