I have written a macro that removes all fields from the document after the
user populates it using dialog boxes (Ask fields). My problem is, I included
coding that unlinked all fields in the header, which I thought was a grand
idea until I realized that it also unlink the Page field!
Is there a way to "protect" the page field so it can not be unlinked when I
run my macro? Or as a fall back, is there a way, using a macro, that I unlink
only the two fields I want unlinked (date and reference number) and leave the
page field intact?
Thanks for any help, I've been searching web but found only global
replacements.
Graham Mayor - 26 May 2008 09:52 GMT
You can conditionally unlink fields eg
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldDate Then
oField.Unlink
End If
Next
Set oField = Nothing

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I have written a macro that removes all fields from the document
> after the user populates it using dialog boxes (Ask fields). My
[quoted text clipped - 9 lines]
> Thanks for any help, I've been searching web but found only global
> replacements.
Olympian151 - 27 May 2008 20:30 GMT
thank you Graham!! it worked great with just the littlest modification for
the header and field! I was too focused on just protecting the Page field.
Thank you again!!
> You can conditionally unlink fields eg
>
[quoted text clipped - 19 lines]
> > Thanks for any help, I've been searching web but found only global
> > replacements.
Graham Mayor - 28 May 2008 06:30 GMT
You are welcome :)

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> thank you Graham!! it worked great with just the littlest
> modification for the header and field! I was too focused on just
[quoted text clipped - 31 lines]
>>> Thanks for any help, I've been searching web but found only global
>>> replacements.