Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit Text Form Field via Macro?

Status
Not open for further replies.

cheriberi

Technical User
May 27, 2003
60
US
Is it possible to change the default text of a Text form field via a macro in Word? In most cases, I have a form field that will stay as is. However, in some cases I need to change the default text of the field, but I can't figure out how to do it.
 
Hi,

This might help
Code:
Sub ChangeText()
    Dim ff As FormField
    For Each ff In ActiveDocument.FormFields
        If ff.Name = "Text1" Then
            ff.Result = "different text"
        End If
    Next
End Sub
:)

Skip,
Skip@TheOfficeExperts.com
 
Your solution works, but there's a catch. It doesn't actually change the default text in the field. So, if I run the macro, what I see in the document will change, but if I lock the document so that I can tab from field to field, what I see will change back to the default text.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top