Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
AAA AAA is offline
external usenet poster
 
Posts: 2
Default Find & Replace change to Uppercase two words

How do I search for a known word "said" and capitalize only the first letter
of the word next to it?

said hi

Change to:

said Hi

Thanks.


  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Find & Replace change to Uppercase two words

The following macro (http://www.gmayor.com/installing_macro.htm) will locate
a chosen word followed by a single space and a lower case letter and change
the case of that letter to upper case:

Sub ChangeCaseOfNextLetter()
Dim strFind As String
On Error GoTo UserCancelled:
strFind = InputBox("Enter the word to be searched for." _
& vbCr & vbCr & "NOTE: Search is case sensitive.", _
"Change following letter to Upper case", "said")
If strFind = "" Then GoTo UserCancelled:
strFind = strFind & " [a-z]"
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:=strFind, _
Wrap:=wdFindContinue, Forward:=True, _
MatchWildcards:=True) = True
With Selection
.MoveRight Unit:=wdCharacter, Count:=1
.MoveLeft Unit:=wdCharacter, Count:=1, _
Extend:=wdExtend
.Range.Case = wdUpperCase
End With
Loop
End With
UserCancelled:
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


AAA wrote:
How do I search for a known word "said" and capitalize only the first
letter of the word next to it?

said hi

Change to:

said Hi

Thanks.




  #3   Report Post  
Posted to microsoft.public.word.docmanagement
AAA AAA is offline
external usenet poster
 
Posts: 2
Default Find & Replace change to Uppercase two words

Thank you Graham, I shall give it a try.

"Graham Mayor" wrote in message
...
The following macro (http://www.gmayor.com/installing_macro.htm) will
locate
a chosen word followed by a single space and a lower case letter and
change
the case of that letter to upper case:

Sub ChangeCaseOfNextLetter()
Dim strFind As String
On Error GoTo UserCancelled:
strFind = InputBox("Enter the word to be searched for." _
& vbCr & vbCr & "NOTE: Search is case sensitive.", _
"Change following letter to Upper case", "said")
If strFind = "" Then GoTo UserCancelled:
strFind = strFind & " [a-z]"
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:=strFind, _
Wrap:=wdFindContinue, Forward:=True, _
MatchWildcards:=True) = True
With Selection
.MoveRight Unit:=wdCharacter, Count:=1
.MoveLeft Unit:=wdCharacter, Count:=1, _
Extend:=wdExtend
.Range.Case = wdUpperCase
End With
Loop
End With
UserCancelled:
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


AAA wrote:
How do I search for a known word "said" and capitalize only the first
letter of the word next to it?

said hi

Change to:

said Hi

Thanks.






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/ Replace is auto-capping the words I want to replace with Graham Mayor Microsoft Word Help 8 January 27th 06 01:39 AM
Use find and replace to change American word to Canadian spelling Retired Microsoft Word Help 8 April 29th 05 06:10 PM
Find and Replace GREEK symbols in XP, 2K & 97 Jazz Microsoft Word Help 3 April 8th 05 08:13 PM
Problem with function "Find and Replace" in Word. Pat Microsoft Word Help 3 March 16th 05 01:04 PM
Find and Replace anomaly BruceM Microsoft Word Help 7 January 18th 05 05:47 PM


All times are GMT +1. The time now is 01:26 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"