• Button on form to reset fields (2003)

    Author
    Topic
    #436306

    Someone has asked me how to put a button on a form in Word that will reset the fields. I have not used the activex controls before. I know how to use the form toolbar to reset the fields. I tried using that button and then copying the code to an activex control, but it doesn’t work. Obviously, I haven’t a clue how to do this.

    Help? The user needs this to be a simple button, but she wants it in the document, not on a toolbar.

    Viewing 0 reply threads
    Author
    Replies
    • #1033992

      Unprotect your document.
      Click in the document where you want the button.
      Show the Control Toolbox toolbar.
      Click on the ‘Command Button’ toolbar button.
      A command button will appear in your document and Design Mode will be turned on.
      You can drag the command button to another position if you like.
      Double click the command button.
      Make the code look like this:

      Private Sub CommandButton1_Click()
      ActiveDocument.Unprotect
      ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=False
      End Sub

      Switch back to Word.
      Turn off Design Mode by clicking the first button on the Control Toolbox.
      Protect your document for Forms again.

      • #1034006

        Thank you, Hans. I knew how to create the command button, but I am so code illiterate, that I didn’t know how to make it actually do anything! This works beautifully.

    Viewing 0 reply threads
    Reply To: Button on form to reset fields (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: