View Single Post
 
Old 05-05-2019, 04:59 AM
Keybraker Keybraker is offline Windows 7 64bit Office 2013
Novice
 
Join Date: May 2019
Posts: 1
Keybraker is on a distinguished road
Default How can I replace FormFields with text

I want to replace every ActiveDocument.FormFields with text, but everything I try is not working .

I am currently looping though ActiveDocument.FormFields.Count and if it is a checkboox I want it to replace the checkbox with the value in text - "0" or "1".


Code:
Sub Test()

    Dim strCheckBoxSlct As String
    Dim strCheckBoxName As String
    Dim strCheckBoxValue As String
    
    For i = 1 To ActiveDocument.FormFields.Count
        If ActiveDocument.FormFields(i).CheckBox Then
        
            strCheckBoxName = ActiveDocument.FormFields(i).Name
            strCheckBoxValue = ActiveDocument.FormFields(i).CheckBox.Value
            strCheckBoxSlct = ActiveDocument.FormFields(i).Range
            
            'ActiveDocument.FormFields(i).Delete
               
            If strCheckBoxValue = True Then
                ' write 0
            Else
                ' write 1
            End If
            
        End If
    Next
    
End Sub
Reply With Quote