Find the value of an charecter adjacent to the selection?

A

and

I would like to step through a document until a full stop is found and
then insert a character IF the next character is a space.

So I look for a "." with Selection.Find, but how could I proceed then?

Does Word XP VBA have a built-in function to evaluate the character next
to the position where the Find statement brings me (the selection
containing the full stop)?


Best,
ANDy
--
 
D

Dave Lett

Hi Andy,

You might find the following useful:

Dim oRng As Range
Set oRng = Selection.Range
oRng.Collapse Direction:=wdCollapseEnd
oRng.MoveEnd unit:=wdCharacter, Count:=1
If oRng.Text = Chr(32) Then
MsgBox "Yes, this is a space."
End If

HTH,
Dave
 

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