Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 06-13-2024, 08:16 AM
vivka vivka is offline VBA Bold text before first colon only Windows 7 64bit VBA Bold text before first colon only Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, Shelley Lou! This simple macro seems to do the job:
Code:
Sub Format_Paras_If()
'In active doc's paras that have a tab/colon, bold the strings
'from paras start until the 1st tab/colon excluding list paras.
'Coded by vivka, 12.06.2024

Dim oRng As range
    Application.ScreenUpdating = False
    Set oRng = ActiveDocument.range
    With oRng.Find
        .ClearFormatting
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchWildcards = True
        .Replacement.ClearFormatting
        .text = "[^t:]"
        Do While .Execute And oRng.ListFormat.ListType = 0
            oRng.End = oRng.start
            oRng.start = oRng.Paragraphs(1).range.start
            oRng.Font.Bold = True
            oRng.start = oRng.Paragraphs(1).range.End
        Loop
    End With
Application.ScreenUpdating = True
Set oRng = Nothing
End Sub

Last edited by vivka; 06-13-2024 at 10:58 PM.
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 02:50 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