Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 11-20-2018, 10:37 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.
there is no password .
I may have been wrong somewhere.
I've done a process of:
Fill out details,
Activating the macro to clear the details,
(happy)
Protect form (no password).

I will try again.
Reply With Quote
 



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 09:33 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