View Single Post
 
Old 10-12-2022, 07:12 AM
bil_san1 bil_san1 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default

Hi Paul,

I have posted the question on your other post. But unfortunately it got moved or removed.

The document in the #1 post has help me a little.

But when I am creating a second Checkbox2 its not working.

Second is it possible to allow user to only select one checkbox only.

Can you please guide me and explain in details, how to get it worked.

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
With ContentControl
  Select Case .Title
    Case "CheckBox1"
      If .Checked = True Then
        ActiveDocument.CustomDocumentProperties("Chk1").Value = 1
      Else
        ActiveDocument.CustomDocumentProperties("Chk1").Value = 0
      End If
    Case "CheckBox2"
      If .Checked = True Then
        ActiveDocument.CustomDocumentProperties("Chk2").Value = 1
      Else
        ActiveDocument.CustomDocumentProperties("Chk2").Value = 0
      End If
    Case Else
  End Select
End With
Application.ActiveWindow.View.ShowFieldCodes = False
Application.Options.PrintFieldCodes = False
ActiveDocument.Fields.Update
Application.ScreenUpdating = True
End Sub

Last edited by bil_san1; 10-12-2022 at 01:11 PM.
Reply With Quote