Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find/ Replace is auto-capping the words I want to replace with | Microsoft Word Help | |||
Use find and replace to change American word to Canadian spelling | Microsoft Word Help | |||
Find and Replace GREEK symbols in XP, 2K & 97 | Microsoft Word Help | |||
Problem with function "Find and Replace" in Word. | Microsoft Word Help | |||
Find and Replace anomaly | Microsoft Word Help |