Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Find the value of an charecter adjacent to the selection?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
and - 06 Jan 2005 13:28 GMT
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
--
Dave Lett - 06 Jan 2005 13:48 GMT
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

> 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.
[quoted text clipped - 8 lines]
> ANDy
> --
Helmut Weber - 06 Jan 2005 14:11 GMT
Hi Andy,

Msgbox Selection.Next

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.