View Single Post
 
Old 05-05-2019, 05:14 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

To replace the formfield checkboxes with text 1 or 0 then

Code:
Sub Test()

Dim rngCheckBoxSlct As Range
Dim strCheckBoxName As String
Dim bCheckBoxValue As Boolean
Dim oFld As FormField

    If Not ActiveDocument.ProtectionType = wdNoProtection Then
        ActiveDocument.Unprotect Password:=""
    End If

    For Each oFld In ActiveDocument.FormFields
        If oFld.Type = wdFieldFormCheckBox Then
            strCheckBoxName = oFld.Name
            bCheckBoxValue = oFld.CheckBox.value
            Set rngCheckBoxSlct = oFld.Range
            If bCheckBoxValue = True Then
                rngCheckBoxSlct.Text = "1"
            Else
                rngCheckBoxSlct.Text = "0"
            End If
        End If
    Next oFld
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