Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-23-2015, 07:58 PM
macropod's Avatar
macropod macropod is offline Clicking the selected Content Control checkbox returns wrong control in vba event Windows 7 64bit Clicking the selected Content Control checkbox returns wrong control in vba event Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,528
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try something along the lines of:
Code:
Private Sub Document_ContentControlOnEnter(ByVal CC As ContentControl)
If CC.Type <> wdContentControlCheckBox Then Exit Sub
Application.ScreenUpdating = False
Dim MyGrp As String, i As Integer, MySelectX As Integer, bChk As Boolean
'get the tag number of the item in the list
If UBound(Split(CC.Tag, "-")) > 0 Then
  If IsNumeric(Right(CC.Tag, 1)) Then
    MySelectX = CInt(Split(CC.Tag, "-")(1))
  Else
    MySelectX = ""
  End If
End If
'Get the base name of the tag group
MyGrp = Split(CC.Tag, "-")(0) & "-"
Select Case CC.Title
  Case "Char"
    bChk = ActiveDocument.SelectContentControlsByTag(MyGrp & MySelectX)(1).Checked
    'if user checks box, uncheck all others in list
    If CC.Checked = True Then
      For i = 0 To 4
        ActiveDocument.SelectContentControlsByTag(MyGrp & i)(1).Checked = False
      Next i
      If bChk = False Then
        ActiveDocument.SelectContentControlsByTag(MyGrp & MySelectX)(1).Checked = True
      End If
    End If
End Select
Application.ScreenUpdating = True
End Sub
You may also be interested in: https://www.msofficeforums.com/word-...html#post33489
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
content control, content control events, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clicking the selected Content Control checkbox returns wrong control in vba event Replace checkbox symbol with check box content control canadansk Word VBA 5 04-01-2015 08:21 AM
Clicking the selected Content Control checkbox returns wrong control in vba event How to Control Worksheet Event Handler in Module? tinfanide Excel Programming 2 10-19-2014 09:46 AM
Clicking the selected Content Control checkbox returns wrong control in vba event Deleting a table from a content control -- preserving the content control BrainSlugs83 Word Tables 8 11-14-2013 03:06 AM
Retrieving content control value jillapass Word VBA 4 05-24-2012 05:07 AM
Excel ->VB code for Checkbox (control toolbox) kirkstyle Excel 0 08-16-2006 04:17 PM

Other Forums: Access Forums

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