![]() |
|
#3
|
||||
|
||||
|
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 |
| Tags |
| checkbox, formfields |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue Using FormFields.Result | boCash | Word VBA | 0 | 04-04-2017 12:54 PM |
| Updating/Locking FormFields | Maskot | Word VBA | 4 | 06-24-2015 04:40 AM |
| Macro to find coloured text and replace with form-field/formtext containing that text | tarktran | Word VBA | 1 | 11-26-2014 08:12 AM |
Mailmerge and Formfields
|
Liosis | Mail Merge | 4 | 03-07-2014 12:56 PM |
| Renaming Word Formfields: string too long error | silverspr | Word VBA | 7 | 01-22-2013 06:20 PM |