How to select a checkbox in Microsoft Word from VB6

al4629740 used Ask the Experts™
I am using VB6 to access a Microsoft Word template.  What I am perplexed on what to do is how to select a checkbox field as you can see from the attached image.  Currently Quarter 2 is selected.  How can I select Quarter 3.  I can bookmark the field, but I don't know the syntax for selection and checking the field.  Any help is appreciated.  

Here is some example code I am currently using in the document if that helps.

            objMSWord.Selection.TypeText "ACTIVITY: " & rec!ActivityName & " - " & rec!ActivityType & "    " & rec!ActivityOther & vbCrLf
            objMSWord.Selection.TypeText "Identified Need: " & rec!Need & "    " & rec!NeedOther & vbCrLf
            objMSWord.Selection.TypeText "Objective Addressed: " & rec!Objectives & vbCrLf
            objMSWord.Selection.TypeText "Stated Strategy: " & rec!Strategy & vbCrLf
            objMSWord.Selection.TypeText "Outcome: " & rec!Outcome & vbCrLf
            objMSWord.Selection.TypeText "Narrative Summary: " & rec!Narrative & vbCrLf
            objMSWord.Selection.TypeText "-----------------------------" & vbCrLf & vbCrLf

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2012

What sort of checkbox?  Is it a Form Field, an Active X or a Content Control? If not in developer mode, all three types of checkbox look very similar.
The code seems to be adding text at a bookmark, so that doesn't help very much.


I think form fields
Top Expert 2012

To use the document, do you have to protect it for 'Filling in forms'?
Top Expert 2012
If you simply want to check it or uncheck it, you can set the Value of the CheckBox property to true or false
Option Explicit
Sub FFCheckBox()
    Dim ffcb As FormField
    Set ffcb = ActiveDocument.FormFields("Check1")
    With ffcb
        If .CheckBox.Value = False Then
            .CheckBox.Value = True
            .CheckBox.Value = False
        End If
    End With
End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial