Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2025, 01:40 AM
rekent rekent is offline Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter Windows 10 Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter Office 2016
Novice
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter
 
Join Date: May 2014
Posts: 23
rekent is on a distinguished road
Default Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter

Hello. I am trying to search a document for the phrase FIG., FIGs. or FIGS. followed by any number and a lower case letter. For example, FIG. 1a. I'm wanting to capitalize the A so that the resulting text is FIG. 1A.



I thought this would do it, but it doesn't, and I'm not sure where I went wrong. The find and basic replace are straightforward enough that I assume it has to be in the UCase portion. Any guidance on where I went wrong?

Code:
With ActiveDocument.Content.Find
  .Text = "(FIG. [1-9])([a-z])"
  .Replacement.Text = "\1"UCase(\2)
  .MatchWildcards = true
  .Text = "(FIG[Ss]. [1-9])([a-z])"
  .Replacement.Text = "\1"UCase(\2)
  .MatchWildcards = true
End With
Bonus points if anyone has an idea on how to tackle a string of multiple similar to "FIGS. 1a, 3b, ..., and 11f ...".
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter Issue with Accented Letter Replacement (Upper/Lower Case) onlywonderboy Word VBA 1 12-21-2017 08:57 PM
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter How to stop Word from capitalizing the first letter? mobileone Word 2 08-27-2016 07:17 PM
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter Find and replace with a macro, problem with letter case garcanrya Word VBA 2 01-10-2014 05:40 AM
Repeatedly capitalizing first letter of a word in a document Microsoftenquirer1000 Word 1 02-21-2013 07:36 PM
Word Macro to Find a phrase followed by a number and a lower case letter, capitalizing the letter Replace is capitalizing the first letter of the first word Beachhouse Word 1 02-07-2012 03:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft