View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default EDIT FORM FIELD OPTION

You will have to delete the incorrect item from the form field properties
(with the form unlocked) and then add it back again.

or

You could use the following macros. Make a note of the dropdown form field
name. The first should be run with the form containing the field to be
edited opened as the active document. A second document is created
containing the entries from the dropdown field. Edit that document to
correct the typo. Then with that document on screen as the active document,
run the second macro. (It will work with Word 2007 docx also and can be run
while the document is protected for forms).

Sub Macro1()
Dim oField As FormField
Dim oDoc As Document
Dim oDatadoc As Document
Dim sName As String
sName = InputBox("Enter dropdown field name")
Set oDoc = ActiveDocument
Set oDatadoc = Documents.Add
Set oField = oDoc.FormFields(sName)
For i = 1 To oField.DropDown.ListEntries.Count
oDatadoc.Range.InsertAfter oField.DropDown.ListEntries(i).name & vbCr
Next i
oDatadoc.Variables("varFormName").Value = oDoc.FullName
oDatadoc.Variables("varFieldName").Value = sName
End Sub

Sub Macro2()
Dim oField As FormField
Dim oDoc As Document
Dim oDatadoc As Document
Dim sFName As String
Dim sName As String
Dim oRng As Range
Set oDatadoc = ActiveDocument
sFName = oDatadoc.Variables("varFormName").Value
sName = oDatadoc.Variables("varFieldName").Value
Set oDoc = Documents.Open(sFName)
Set oField = oDoc.FormFields(sName)
oField.DropDown.ListEntries.Clear
For i = 1 To oDatadoc.Paragraphs.Count - 1
Set oRng = oDatadoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
oField.DropDown.ListEntries.Add oRng, i
Next i
End Sub


http://www.gmayor.com/installing_macro.htm


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"William" wrote in message
...
I have a document with a drop down form field. One of the options has a
typo
I'd like to change, but I can't seem to do it in the Drop Down Form Field
Options dialog box. The item is one of those very long webpage addresses
so
I'd like to find an easy way to change one character in the address.

Can this be done?
--
William