Unlinking Fields

K

Karen VM

In Word 2000, can you unlink a specified field throughout the document in one
shot?
 
S

Stefan Blom

Sure. To unlink all SEQ fields, for example, use this macro:

Dim f As Field
For Each f In ActiveDocument.Fields
If f.Type = wdFieldSequence Then
f.Unlink
End If
Next f

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
K

Karen VM

Well this worked for the fields in the main text, but how do I unlink in
headers too? Also, my field is DocProperty for which I have several custom
codes, eg, DocProperty "Compound", DocProperty "Species" etc... How can I
specify a specific code to unlink? Thanks so much for your prompt help - I've
spent 2 days trying to figure this out as a "newbie"
 
S

Stefan Blom

Graham's article provides examples for searching all stories of a
document. But, as far as I can tell, it does not explain how to find a
specific "flavor" of a field, for example, how to find { DOCPROPERTY
"Compound" } but not { DOCPROPERTY "Title" }. For that, you would have
to investigate the field code directly:

If Instr(UCase$(f.Code.Text), "COMPOUND") Then
f.Unlink
End If

--
Stefan Blom
Microsoft Word MVP


in message
 
G

Greg Maxey

Stefan,

Apparently you where paying closer attention to the question than me ;-)

I will add an example of looking to this level in the article when I get a
chance.

Thanks.
 
J

Jonathan West

BABs said:
Is there any way to unlink the fields without opening the document, using
code?

No. The document has to be open for you to make any changes to it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top