Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2017, 10:23 PM
gmayor's Avatar
gmayor gmayor is offline Content Control Checkboxes Windows 10 Content Control Checkboxes Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You have to actually enter the content control from outside the control in order for the ContentControlOnEnter sub to fire. It doesn't operate on simply toggling the control. Thus the following should demonstrate.



Code:
Option Explicit

Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
    Select Case ContentControl.Title
        Case "ccHW"
            If ContentControl.Checked Then
                FillBM "HW", "This is the content of bookmark HW"
            Else
                FillBM "HW", ""
            End If
        Case "ccCS"
            If ContentControl.Checked Then
                FillBM "CS", "This is the content of bookmark CS"
            Else
                FillBM "CS", ""
            End If
    End Select
End Sub

Private Sub FillBM(strBMName As String, strValue As String)
'Graham Mayor - http://www.gmayor.com
Dim oRng As Range
    With ActiveDocument
        On Error GoTo lbl_Exit
        Set oRng = .Bookmarks(strBMName).Range
        oRng.Text = strValue
        oRng.Bookmarks.Add strBMName
    End With
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #2  
Old 01-05-2017, 05:52 PM
wlcdo2 wlcdo2 is offline Content Control Checkboxes Windows 7 32bit Content Control Checkboxes Office 2013
Novice
Content Control Checkboxes
 
Join Date: Jun 2016
Posts: 17
wlcdo2 is on a distinguished road
Default

Thank you so much Graham. I used your code and now have a slightly better understanding of the ContentControl checkboxes. I'm think I'm going to leave a mixture of ContentCOntrols and ActiveX Controls in my document for now but will keep toiling away based on what I've learned from you.
Once again, may thanks.

Paul, Thanks too for your feedback and links that were provided.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Control Checkboxes Help with Content Control Box dep7418 Word 2 12-18-2016 08:08 PM
Content Builder Using Checkboxes MauriceP Word 2 10-19-2015 09:49 PM
Content Control Checkboxes Clicking the selected Content Control checkbox returns wrong control in vba event DougsGraphics Word VBA 2 06-24-2015 07:31 AM
Content Control Checkboxes Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Content Control Checkboxes Assigning Values to content control checkboxes and calculating results creative cathy Word Tables 13 10-07-2012 08:52 PM

Other Forums: Access Forums

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