#1
|
|||
|
|||
Using wildcards in Find/Replace to change font/case
Hello, I've been wracking my brain over this...
I have a document typed in all caps (the font is formatted in all caps) and I need to find a way to convert all the text within brackets to sentence case. After much digging, I found the way to convert all the bracketed text to lowercase, but I really need the first letter of each text within those brackets to be capitalized. For example, it needs to look like this: THIS TEXT CAN STAY IN ALL CAPS. [But this text needs to be in sentence case] When I look through all the options in the Find/Replace I don't see anything that lets me choose "sentence case". So I'm wondering if there is a step two that is necessary in order to take all the bracketed text and convert it to sentence case. But how would I do that? Can I create a macro or command that takes every character immediately preceded by a [ and changes it to a capital letter? Any help or ideas would be greatly appreciated. Thank you! |
#2
|
||||
|
||||
A Find/Replace can't change case that way - a macro would be needed, such as:
Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "\[*\]" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found .Case = wdTitleSentence .Characters(2) = UCase(.Characters(2)) .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul,
Thank you so much!! This code works beautifully. Now I'm just trying to attach it to a button that I can pin to the toolbar for easy access. Thank you!! Angela |
Tags |
format style, sentence case, wildcards |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using wildcards how do I Find and Add to, not replace | Stargehzer | Word | 3 | 01-25-2016 09:14 PM |
Find/replace font colour in all header/footer | trillium | Word VBA | 4 | 10-20-2015 10:39 PM |
Find & Replace: Wildcards (except this pattern) | tinfanide | Word | 6 | 01-26-2014 06:39 AM |
Find and replace with a macro, problem with letter case | garcanrya | Word VBA | 2 | 01-10-2014 05:40 AM |
wildcards in find & replace to reverse word order | jeffk | Word | 3 | 11-11-2012 01:47 PM |