#1
|
|||
|
|||
Can't reset form fields (Word 2013) and conditional formatting
Hello everyone!
I have a survey and the answers are all in a drop-down form. The survey will be filled out by several respondents and I'd like the options to be reset each time. I've seen the Reset Form Fields eraser icon under Legacy Forms but when I clicked on it, nothing happened. Also, how do I know if my document is protected or unprotected? Thank you in advance. Last edited by Charles Kenyon; 10-15-2015 at 04:30 AM. Reason: changed title to give more info |
#2
|
||||
|
||||
Save the empty form as a template and create new documents fom it. The new documents will always be cleared of data and there will be no danger of inadvertently saving over wanted data.
The document protection is on the developer tab of the ribbon. You may need to enable the developer tab from the built-in ribbon editor.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Quote:
|
#4
|
||||
|
||||
For some conditional formatting code, see: https://www.msofficeforums.com/word-...html#post47254
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Quote:
Quote:
|
#6
|
||||
|
||||
As coded, the macro in the link is for just a single table cell. To work with multiple dropdowns, you could use code like:
Code:
Dim lTbl As Long, lRow As Long, lCol As Long, lClr As Long Const StrPwd As String = "" Sub ConditionalFormat() With ActiveDocument If .ProtectionType = wdAllowOnlyFormFields Then .Unprotect , StrPwd .Tables(lTbl).Cell(lRow, lCol).Range.Shading.BackgroundPatternColor = lClr .Protect wdAllowOnlyFormFields, True, NoReset:=True, Password:=StrPwd End With End Sub Code:
Sub DD1Fmt() With ActiveDocument.FormFields("Dropdown1") lTbl = ActiveDocument.Range(0, .Range.End).Tables.Count lRow = .Range.Cells(1).RowIndex lCol = .Range.Cells(1).ColumnIndex Select Case .Result Case "Unknown": lClr = wdColorPink Case "Yes": lClr = wdColorLightBlue Case "No": lClr = wdColorBrightGreen Case Else: lClr = wdColorYellow End Select Call ConditionalFormat End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Just to verify, I will be pasting both codes right? And this is each time I will be editing a drop-down list? And also for the StrPwd "", am I the one to set that password? If so, where? Sorry I am really confused and thank you so much for all your help and patience.
|
#8
|
|||
|
|||
You set the password, if you wish one, when you protect the document for forms. You would need to set it in the code before you protect the document.
For more on the developer tab, see Developer Tab. |
#9
|
||||
|
||||
Yes.
No. It's only the second sub that would be replicated. You would need to change its name (e.g. from DD1 to DD2) and the name of the Dropdown in references (e.g. from Dropdown1 to Dropdown2). Unless you apply forms passwording to the document, you can leave in blank; otherwise, give it the same name as the password you apply in the document.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Quote:
Last edited by rogelinepaula; 10-15-2015 at 06:02 PM. Reason: Confidentiality |
#11
|
||||
|
||||
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Quote:
Last edited by rogelinepaula; 10-15-2015 at 04:41 PM. Reason: Typo |
#13
|
||||
|
||||
That's because there isn't one. A formfield only ever has the bookmark you (or Word) give it - you can't choose an existing bookmark that's been assigned somewhere else.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
But how do I make it as a drop-down list when it won't show the options I'll be providing? This is not the content control I am using but the one from the Legacy Tools.
|
#15
|
||||
|
||||
All you need do is apply the 'filling in forms' editing restrictions. Once you do that the dropdown becomes active.
That said, if your other questions have dropdown content controls, you really should stick to one kind of control - formfields and content controls don't work well together. Unlike formfields, content controls don't require the 'filling in forms' editing restrictions to work. And, since you'll need macros for what you want to do, you could just as well use content controls throughout. In some respects, that would make coding for the conditional formatting simpler, too.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to keep formatted form fields after mail merge or replace text with formatted form fields | jer85 | Word VBA | 2 | 04-05-2015 10:00 PM |
Reinstalling Office 2013 after factory reset | barryd | Office | 1 | 05-17-2013 04:24 PM |
Form Fields in Word | jwm1346 | Word | 1 | 04-17-2012 07:02 PM |
Preventing Form Fields to Reset | PosseJohn | Word VBA | 4 | 07-15-2011 09:44 PM |
Form fields in Word messed up | mba | Word VBA | 0 | 02-07-2010 09:54 PM |