Automatic Fill-in Form in Word

I would like to create a form in word with four questions on it with a field for answer under each question.  But I would like to have a macro that becomes active when the form is opened.  The macro should pop-up a mini window with question 1, 2, 3, 4 in order (but one question per window at a time) and should have a field for inputting the answer.  Up on entering each answer in the pop-up window, the macro should automatically populate the Form with the correct font etc..

Any and All help will be greatly appreciated.  I am sure it will be a piece of Cake for most of you.

 

JJ



Answer this question

Automatic Fill-in Form in Word

  • Spanglishone

    Hi JJ

    Try this for a solution ...

    Create your form, including a help key message text. You could also consider default values if appropriate.

    Put the following code in the ThisDocument module

    Private Sub Document_Open()

    Dim aFF As FormField

    With ThisDocument
    For Each aFF In .FormFields
    If aFF.Type = wdFieldFormTextInput Then
    aFF.Result = InputBox(prompt:=aFF.HelpText, Default:=aFF.Result)
    End If
    Next aFF
    End With

    End Sub

    Save the document, close it, and then open it again and see what happens.

    What this actually does is loop through all FormFields, testing for Text Form Fields, and when it finds one it asks for information using the help text as the prompt and applying the default value already set as the default value for input.

    Regards

    Peter Mo.


  • Automatic Fill-in Form in Word