Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2018, 11:29 PM
Rafi Rafi is offline Reset "Button" to clear Word user-filled form, from all filled details. Windows 7 64bit Reset "Button" to clear Word user-filled form, from all filled details. Office 2016
Novice
Reset "Button" to clear Word user-filled form, from all filled details.
 
Join Date: Nov 2018
Location: Israel
Posts: 15
Rafi is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Are you using a password on the form protection? Assuming there is no password, and the form is protected before the macro is run, the following modifications would be required.


Code:
Sub ClearForm()
  Dim aCC As ContentControl
  ActiveDocument.Unprotect
  For Each aCC In ActiveDocument.ContentControls
    aCC.Range.Select
    If aCC.Type <> wdContentControlDropdownList Then
      aCC.Range.Text = ""
    Else
      aCC.Type = wdContentControlText
      aCC.Range.Text = ""
      aCC.Type = wdContentControlDropdownList
    End If
  Next aCC
  ActiveDocument.Protect wdAllowOnlyFormFields
End Sub
This code will fail if the form is not already protected or has a password so a better solution would be to add more lines of code to check first.
The two codes you -Guessed & gmaxey- provided me , are working very effectively!

When I applied them to more forms, especially with a few boxes, they work perfectly!
I'll have to make do with it right now.

I need to take the time and try to learn more about the "preparation" of the form for the code , all in order to make intelligent use of the useful codes that you have given me.

Thank you very very much for your warm hospitality and helpful explanations.
Reply With Quote
  #2  
Old 10-13-2021, 01:48 AM
arnold_zee32 arnold_zee32 is offline Reset &quot;Button&quot; to clear Word user-filled form, from all filled details. Windows 10 Reset &quot;Button&quot; to clear Word user-filled form, from all filled details. Office 2016
Novice
 
Join Date: Oct 2021
Posts: 2
arnold_zee32 is on a distinguished road
Default

Hi. The code works with text but does not work with check box content control. can we add it in the code please. thank you.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
button "clear format", etc; anchors, functions and properties of OpenType, negative width of symbol? tvan Other Software 1 07-18-2018 03:55 PM
Using outlook form to enforce field to be filled in megatronixs Outlook 1 01-21-2015 01:11 PM
Text form filled shading Barbara Word 2 04-25-2013 05:21 AM
Reset &quot;Button&quot; to clear Word user-filled form, from all filled details. Add a "SAVE" Button to a form template? Dave L Word 9 03-21-2012 07:04 PM
How can create a form in Word 2007 that can be automatically filled? artistech Word 0 08-04-2010 01:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:24 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