Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unlinking Fields

    In Word 97 I need to unlink all form fields in a document (headers and footers too) without unlinking the page numbers. Is there a way to differentiate the different types of fields with the unlink method? Or is there a way to test the field to see if it is of a particular type?

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Unlinking Fields

    Give this macro a try
    <pre>Sub temp1()
    'Macro created by Andrew Lockton 22JUN01
    Dim aField As Variant
    For Each aField In ActiveDocument.Fields
    If aField.Type <> wdFieldPage Then
    aField.Unlink
    End If
    Next aField
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unlinking Fields

    Thank you.

    I ended up with something similar by cobbling together the solutions to a couple other answers in the Lounge. Seems to work.

    Sub UnlinkRefFields()

    ' Added by B Tierney to step through all parts of document and change only field codes of wdFieldRef type to editable text, but not page number codes.

    Dim aField As Field
    Dim rStory As Range

    For Each rStory In ActiveDocument.StoryRanges
    For Each aField In rStory.Fields
    If aField.Type = wdFieldRef Then aField.Unlink
    Next aField
    Next rStory

    End Sub

Posting Permissions

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