![]() |
|
#9
|
||||
|
||||
|
The initial post included this line
If Me.CheckBox1.Value This made me think that you had the checkboxes on a VBA Userform since 'Me' is a reference to a VBA userform. If you ACTUALLY have Content Control Checkboxes in the body of the document then the coding can be simpler. Put this code into the ThisDocument module. You won't need any other code if you have set up your Tag/Title combinations with the Content Controls. Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
Dim aCC2 As ContentControl, sTag As String
If aCC.Type = wdContentControlCheckBox Then
sTag = aCC.Tag
Set aCC2 = ActiveDocument.SelectContentControlsByTitle(sTag)(1)
With aCC2
If aCC.Checked Then
aCC2.Range.Text = "Title" & vbTab & "First line"
aCC2.Range.Words(1).Bold = True
Else
aCC2.SetPlaceholderText Text:="Blank"
aCC2.Range.Text = ""
End If
End With
End If
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
| Tags |
| bold header |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
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 (or unbold) section of text instead of bold toggling
|
Burt | Word | 6 | 04-06-2019 09:09 AM |
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 |
Not Bold text but it comes up bold
|
Pluviophile | Word | 7 | 10-22-2013 10:29 AM |
VBA code to extract specific bookmarks from multiple word files
|
Rattykins | Word VBA | 4 | 06-27-2012 10:02 PM |