Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-05-2019, 08:25 AM
gmaxey gmaxey is online now How can I replace FormFields with text Windows 10 How can I replace FormFields with text Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I didn't test those and I suppose they work, but I don't see the point of strCheckBoxName or bCheckBoxValue or rngCheckBoxSlct??


Code:
Sub Test()
Dim lngIndex As Long
Dim oFld As FormField
  If Not ActiveDocument.ProtectionType = wdNoProtection Then
    ActiveDocument.Unprotect Password:=""
  End If
  For lngIndex = ActiveDocument.FormFields.Count To 1 Step -1
    Set oFld = ActiveDocument.FormFields(lngIndex)
      If oFld.Type = wdFieldFormCheckBox Then
        If oFld.CheckBox.Value = True Then
          oFld.Range.Text = "1"
        Else
          oFld.Range.Text = "0"
        End If
      Else
        oFld.Range.Text = oFld.Result
      End If
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

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
How can I replace FormFields with text 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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft