Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #20  
Old 01-16-2024, 06:44 PM
Guessed's Avatar
Guessed Guessed is offline Bold certain parts of bookmarks text code help Windows 10 Bold certain parts of bookmarks text code help Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I also support Italophile's advice, you should be storing the insertable formatted content into building blocks which can be retrieved anytime the macro requires it. Demo code to put it into a Rich Text Content Control looks like this.
Code:
Private Sub Document_ContentControlOnexit(ByVal aCC As ContentControl, Cancel As Boolean)
  Dim aCC2 As ContentControl, sTag As String, aTemplate As Template
  
  If aCC.Type = wdContentControlCheckBox Then
    sTag = aCC.Tag
    Set aTemplate = ActiveDocument.AttachedTemplate
    Set aCC2 = ActiveDocument.SelectContentControlsByTitle(sTag)(1)
    With aCC2
      If aCC.Checked Then
        aTemplate.BuildingBlockEntries("aa").Insert where:=aCC2.Range, RichText:=True
      Else
        aCC2.SetPlaceholderText Text:="Blank"
        aCC2.Range.Text = ""
      End If
    End With
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
bold header

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bold certain parts of bookmarks text code help How to code a Find&Replace macro to remove a tab and bold the entire para Frogoogue Word VBA 4 05-30-2022 09:15 AM
Bold certain parts of bookmarks text code help bold (or unbold) section of text instead of bold toggling Burt Word 6 04-06-2019 09:09 AM
Bold certain parts of bookmarks text code help 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
Bold certain parts of bookmarks text code help Not Bold text but it comes up bold Pluviophile Word 7 10-22-2013 10:29 AM
Bold certain parts of bookmarks text code help VBA code to extract specific bookmarks from multiple word files Rattykins Word VBA 4 06-27-2012 10:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:01 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