Sally,
Your existing macro wound't find things like "NOTE: Start here" because your
current seach criteria is looking for "NOTE: [a-z]{1,}>" which excludes any
word following the colon that starts with an upper case letter.
Again, it is often easier to perform find and replace operation using the
range object vice the selection object:
Sub UNOTESmallCase()
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute("NOTE: [A-Za-z]{1,}>", MatchWildcards:=True)
oRng.Select 'So you can see which word is being processed.
Select Case MsgBox("Do you want to remove the colon in this
instance?", _
vbQuestion + vbYesNoCancel, "Remove :")
Case vbCancel
Exit Sub
Case vbYes
oRng = Replace(oRng.Text, ":", "")
If oRng.Words.Last.Characters.First.Case <> wdUpperCase Then
oRng.Words.Last.Characters.First.Case = wdUpperCase
End If
End Select
oRng.Collapse wdCollapseEnd
Loop
End With
End With
End Sub
--
Greg Maxey - Word MVP
My web site
http://gregmaxey.mvps.org
Designingsally said:
let me try to elaborate. the macros searchs for NOTE: and then deletes : .
I
want the letter after : to be in upper case if in the lower case.
To captalize the macros i know is Selection.Range.Case = wdNextCase. But
the
whole word after : is captalization.
THoughts??
the code im trying to use is:
Sub UNOTESmallCase()
Dim oRng As Range
Dim sCase As String
With Selection
.HomeKey wdStory
With .FInd
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute("NOTE: [a-z]{1,}>", _
MatchWildcards:=True)
Set oRng = Selection.Range
oRng.Select
sCase = Msgbox("Remove :", vbYesNo, "Change Case")
If sCase = vbYes Then
Selection.HomeKey Unit:=wdLine
Selection.Range.Case = wdNextCase
oRng = Replace(oRng.Text, ":", "")
End If
Selection.Collapse wdCollapseEnd
Loop
End With
End With
End Sub
--
I believe in Hope.
DesigningSally
Designingsally said:
Hi i got a doc where i want to captalize first letter of every word?
can macros go that?
Selection.Range.Case = wdNextCase ain't helping me