![]() |
#2
|
||||
|
||||
![]()
Hi Jennifer,
Here's a macro that should free you from the std F/R constraints: Code:
Sub Demo() Dim StrRep As String, StrLeft As String, StrRight As String, i As Long With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = InputBox("What is the text to Find") .Replacement.Text = "" StrRep = InputBox("What is the Replace text") StrLeft = Left(StrRep, 1) StrRight = Right(StrRep, Len(StrRep) - 1) .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found i = i + 1 With .Duplicate If .Words.First = .Sentences(1).Words.First Then .Text = UCase(StrLeft) & StrRight Else .Text = StrLeft & StrRight End If End With .Collapse wdCollapseEnd .Find.Execute Loop End With MsgBox i & " instances replaced." End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about Case statement | Jennifer Murphy | Word VBA | 1 | 01-05-2013 02:30 PM |
![]() |
tinfanide | Excel | 2 | 09-13-2011 05:08 AM |
Case Sensitive (contains) Selection | apolloman | Excel | 2 | 07-12-2011 04:50 AM |
![]() |
davers | Word | 1 | 04-30-2009 12:41 PM |
Upper to lower case | jd | Excel | 1 | 04-28-2006 07:40 AM |