![]() |
|
#1
|
|||
|
|||
![]()
Hi, Lydia90! The code is simple and it does what you want. I added an inputbox in case you want to find sth else. Selection allows working on any selected range incl. the active document (Ctrl+A)
Code:
Sub Uppercase_Stri() 'In slection, find all instances of the inputboxed string 'and capitalize all their letters. Dim myRng As range Dim stri As String Set myRng = selection.range stri = InputBox("Enter the string to find") With myRng.Find .ClearFormatting .Replacement.ClearFormatting .text = stri .Replacement.Font.AllCaps = True .Forward = True .Format = True .MatchCase = True .MatchWholeWord = True .MatchSoundsLike = False .MatchAllWordForms = False .MatchWildcards = False .Wrap = wdFindStop .Execute Replace:=wdReplaceAll End With End Sub |
#2
|
|||
|
|||
![]()
Hey vivka,
that seems not to work for me. am i doing something wrong? when i start the makro, enter a string and press "ok", nothing happen. ![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Marrick13 | Word VBA | 17 | 03-21-2023 07:51 PM |
![]() |
TEAllred | Word | 1 | 11-22-2015 03:21 PM |
![]() |
carnestw | Word | 3 | 10-27-2015 12:34 PM |
![]() |
jhats | Word | 1 | 07-29-2014 11:53 PM |
![]() |
trew | Word | 7 | 11-21-2012 12:54 AM |