Hi epuglise,
I just came across this issue (or a very very similar one) working on my own project developing a form/template.
Like you, I wanted to reset only one field (or in some cases, I wanted to unprotect and then protect the form without resetting anything ...don't ask...)
The problem for me was that the ActiveDocument.Protect command/method was resetting all of the fields no matter what.
So I found out that you can add a parameter like so:
ActiveDocument.Protect Password:="", NoReset:=True, Type:= _
wdAllowOnlyFormFields
(see the part about "NoReset")
That was the key for me. I don't know if it is the same solution you need.
The part about resetting only one field should be easy enough, just "MyField.Update" (or if not MyField, then whatever you are naming your object variable, or ActiveDocument.Fields(x).U
P.S. - Hi, GrahamSkan !!!
Main Topics
Browse All Topics





by: GrahamSkanPosted on 2004-09-14 at 02:11:23ID: 12052443
I think this is what you need:
t.Default .Value = rng.FormFields(1).CheckBox .Default .Value = rng.FormFields(1).DropDown .Default
Put the cursor in the formfield and run this macro
Sub ResetToDefault()
Dim rng As Range
Dim i As Integer
ActiveDocument.Unprotect
Set rng = Selection.Range
'look backward to the start of the formfield
Do Until rng.FormFields.Count = 1
rng.Start = rng.Start - 1
Loop
Select Case rng.FormFields(1).Type
Case wdFieldFormTextInput
rng.FormFields(1).Result = rng.FormFields(1).TextInpu
Case wdFieldFormCheckBox
rng.FormFields(1).CheckBox
Case wdFieldFormDropDown
rng.FormFields(1).DropDown
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub