Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-13-2024, 04:10 AM
gmaxey gmaxey is offline VBA Bold text before first colon only Windows 10 VBA Bold text before first colon only Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
   Set oRng = ActiveDocument.Range
   With oRng.Find
     .ClearFormatting
     .Forward = True
     .Wrap = wdFindContinue
     .Format = True
     .MatchWildcards = True
     .Replacement.ClearFormatting
      'Get rid of quotes
     .Text = "(" & Chr(34) & ")([A-Z][!^13]@)(" & Chr(34) & ")([^t:])"
     .Replacement.Text = "\2\4"
     .Execute Replace:=wdReplaceAll
     'Bold terms
     .Text = "([A-Z][!^13]@[^t:])"
     .Replacement.Text = "\1"
     .Replacement.Font.Bold = True
     .Execute Replace:=wdReplaceAll
   End With
lbl_Exit:
   Exit Sub
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bold Term Macro that DOES NOT bold terms with Quotation Marks NotOriginal Word VBA 2 03-14-2024 02:22 PM
Bold Header if it is not Bold (Check to see if it is Bold) armendarizj Word 2 01-06-2022 05:45 PM
VBA Bold text before first colon only bold (or unbold) section of text instead of bold toggling Burt Word 6 04-06-2019 09:09 AM
VBA Bold text before first colon only Text in #1 is made bold, rest of the document is edited, text in #1 is now not bold footer-assistance Word 1 06-29-2015 03:49 AM
VBA Bold text before first colon only Not Bold text but it comes up bold Pluviophile Word 7 10-22-2013 10:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:21 AM.


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