Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleting formfields via a macro (word2000)

    I have a document with 2 drop down form fields, a number of check boxes and text form fields. Is it possible to delete these form fields from the document and replace them with the text that they contain using code? Any advice on if this is possible would be appreciated.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Deleting formfields via a macro (word2000)

    Rob,

    Here's a simple macro to do this. Note that with regard to the checkboxes, a checked checkbox will be replaced with the text "1", and an unchecked checkbox will be replaced with the text "0".

    <pre>Public Sub ReplaceFormfields()

    Dim FF As FormField
    Dim strValue As String

    ActiveDocument.Unprotect

    For Each FF In ActiveDocument.FormFields
    FF.Select
    strValue = FF.Result
    Selection.Delete
    Selection.TypeText strValue
    Next 'FF

    End Sub
    </pre>

    Gary

  3. #3
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting formfields via a macro (word2000)

    Thanks Gary

    Just what I needed.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •