Error! Bookmark not found.

D

dougmcr8

I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.
 
J

Jay Freedman

I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.

Index marking is done with fields -- they should be XE fields, which are
automatically marked as Hidden text.

The "default" field type is a REF field; if the first word in the field code
isn't recognized as one of the special field keywords, then Word assumes that
the code is the name of a bookmark that it should refer to. The error message
you see is what a REF field displays when there is no bookmark with the "name"
in the field code.

What has apparently happened to your document is that all the XE fields have
been damaged in some way so they aren't recognized as XE or any of the other
known keywords, so they're assumed to be REF fields referring to nonexistent
bookmarks. I don't know how that may have happened.

Right-click any of the error messages and choose Toggle Field Codes. What do you
see within the braces? Look at a number of them. Depending on how uniform these
broken codes are, it may be possible to remove them with a properly constructed
Replace command.
 
D

dougmcr8

Jay Freedman said:
I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.

Index marking is done with fields -- they should be XE fields, which are
automatically marked as Hidden text.

The "default" field type is a REF field; if the first word in the field code
isn't recognized as one of the special field keywords, then Word assumes that
the code is the name of a bookmark that it should refer to. The error message
you see is what a REF field displays when there is no bookmark with the "name"
in the field code.

What has apparently happened to your document is that all the XE fields have
been damaged in some way so they aren't recognized as XE or any of the other
known keywords, so they're assumed to be REF fields referring to nonexistent
bookmarks. I don't know how that may have happened.

Right-click any of the error messages and choose Toggle Field Codes. What do you
see within the braces? Look at a number of them. Depending on how uniform these
broken codes are, it may be possible to remove them with a properly constructed
Replace command.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Jay - Thanks much. I toggled a sample and they all look like an Automark
entry should look [when Show/Hide is not on], i.e. { "Word" }. So if you can
remind me how to replace every one of those several thousand entries during a
single Find/Replace operation then I'll try to insert a new Index and see
what happens. Appreciate the assist here.
 
J

Jay Freedman

Jay Freedman said:
I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.

Index marking is done with fields -- they should be XE fields, which are
automatically marked as Hidden text.

The "default" field type is a REF field; if the first word in the field code
isn't recognized as one of the special field keywords, then Word assumes that
the code is the name of a bookmark that it should refer to. The error message
you see is what a REF field displays when there is no bookmark with the "name"
in the field code.

What has apparently happened to your document is that all the XE fields have
been damaged in some way so they aren't recognized as XE or any of the other
known keywords, so they're assumed to be REF fields referring to nonexistent
bookmarks. I don't know how that may have happened.

Right-click any of the error messages and choose Toggle Field Codes. What do you
see within the braces? Look at a number of them. Depending on how uniform these
broken codes are, it may be possible to remove them with a properly constructed
Replace command.
Jay - Thanks much. I toggled a sample and they all look like an Automark
entry should look [when Show/Hide is not on], i.e. { "Word" }. So if you can
remind me how to replace every one of those several thousand entries during a
single Find/Replace operation then I'll try to insert a new Index and see
what happens. Appreciate the assist here.

A field code that looks like { "Word" } is _not_ what a marked index entry
should look like -- it should have an XE keyword at the start.

Be that as it may, I was trying to see whether the codes of these damaged fields
contained a common portion that the Replace could search for, but it looks like
the answer is no. That means the solution needs to be programmed as a macro with
more intelligence than a simple Replace.

Follow the instructions in http://www.gmayor.com/installing_macro.htm to paste
the following macro into the VBA editor, in your Normal template.

Sub DeleteBadRefs()
Dim idx As Long
Dim oFld As Field
For idx = ActiveDocument.Fields.Count To 1 Step -1
Set oFld = ActiveDocument.Fields(idx)
With oFld
If .Type = wdFieldRef And _
InStr(.Result, "Error!") Then
.Delete
End If
End With
Next
End Sub

This macro examines each field in the document. If the field is a Ref field that
displays an error message, it deletes that field.
 
D

dougmcr8

Jay - Thanks for the feedback. Please let me clarify to ensure the right next
steps. When I Right Click/Toggle Field the "Error Bookmark not defined."
error message the revealed field appears as { "Word" }. But when I turn on
the Show/Hide tool, all the fields appear as they properly should for an
index entry, i.e. {XE "Word"}. The "XE" is in there. Can I do a Find/Replace
to eliminate the current Index entries using a wildcard entry in the Find
block and nothing in the Replace block? I seem to remember something like
that but cannot remember what the Find entry should look like to eliminate
every Indexed Entry. Thanks

Jay Freedman said:
Jay Freedman said:
I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.

Index marking is done with fields -- they should be XE fields, which are
automatically marked as Hidden text.

The "default" field type is a REF field; if the first word in the field code
isn't recognized as one of the special field keywords, then Word assumes that
the code is the name of a bookmark that it should refer to. The error message
you see is what a REF field displays when there is no bookmark with the "name"
in the field code.

What has apparently happened to your document is that all the XE fields have
been damaged in some way so they aren't recognized as XE or any of the other
known keywords, so they're assumed to be REF fields referring to nonexistent
bookmarks. I don't know how that may have happened.

Right-click any of the error messages and choose Toggle Field Codes. What do you
see within the braces? Look at a number of them. Depending on how uniform these
broken codes are, it may be possible to remove them with a properly constructed
Replace command.
Jay - Thanks much. I toggled a sample and they all look like an Automark
entry should look [when Show/Hide is not on], i.e. { "Word" }. So if you can
remind me how to replace every one of those several thousand entries during a
single Find/Replace operation then I'll try to insert a new Index and see
what happens. Appreciate the assist here.

A field code that looks like { "Word" } is _not_ what a marked index entry
should look like -- it should have an XE keyword at the start.

Be that as it may, I was trying to see whether the codes of these damaged fields
contained a common portion that the Replace could search for, but it looks like
the answer is no. That means the solution needs to be programmed as a macro with
more intelligence than a simple Replace.

Follow the instructions in http://www.gmayor.com/installing_macro.htm to paste
the following macro into the VBA editor, in your Normal template.

Sub DeleteBadRefs()
Dim idx As Long
Dim oFld As Field
For idx = ActiveDocument.Fields.Count To 1 Step -1
Set oFld = ActiveDocument.Fields(idx)
With oFld
If .Type = wdFieldRef And _
InStr(.Result, "Error!") Then
.Delete
End If
End With
Next
End Sub

This macro examines each field in the document. If the field is a Ref field that
displays an error message, it deletes that field.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
J

Jay Freedman

Jay - Thanks for the feedback. Please let me clarify to ensure the right next
steps. When I Right Click/Toggle Field the "Error Bookmark not defined."
error message the revealed field appears as { "Word" }. But when I turn on
the Show/Hide tool, all the fields appear as they properly should for an
index entry, i.e. {XE "Word"}. The "XE" is in there. Can I do a Find/Replace
to eliminate the current Index entries using a wildcard entry in the Find
block and nothing in the Replace block? I seem to remember something like
that but cannot remember what the Find entry should look like to eliminate
every Indexed Entry. Thanks

Since I don't know exactly how the "damaged" fields (the ones that display the
error message) are different from undamaged ones, it's hard to say what the
result of any operation will be.

The absolutely required first step -- which I should have mentioned before -- is
to make a copy of your document, and try any repairs *only* on the copy. If
something goes horribly wrong, you can throw away the copy and make a new copy
of the original.

If you want to try a Replace, here are the steps:

1. Turn on the Show/Hide (or at least go to Office button > Word Options >
Display and check the box for Hidden text) so you can see the codes of the
undamaged XE fields.

2. Press Alt+F9, which toggles all the field codes at once. Now you should see
the codes of the fields that cause the error messages also.

3. In the Replace dialog, click in the "Find what" box and enter this:

^19 XE

Be sure to include one space between the 9 and the X. Then click the Replace All
button.

If Word really sees the codes internally the way it displays them on the screen
(and the appearance of the error messages makes me doubt this), then the Replace
will remove all of the index entries from the document -- both the bad ones and
the good ones -- and you can then rerun the AutoMark operation. If the stars are
aligned against you, it will remove only the good ones.

If this try fails, use the macro I gave you before. It occurs to me that it
might be useful to check each field only to see whether its result is the error
message, since I can't tell whether Word really "thinks" it's a Ref field. The
adjustment is to change the lines

If .Type = wdFieldRef And _
InStr(.Result, "Error!") Then

to just this:

If InStr(.Result, "Error!") Then
 
D

dougmcr8

Good Day Jay - Thanks for your patience. I am not smart enough to make that
macro run. I could not figure out how to paste it in from that website so I
tried just typing it in and Brother Gates advised I did not know how to write
a macro correctly. However I have managed to eliminate the {XE "xxxx"}
entries. When I toggle fields now all that appears to be left are these {ref
"xxxx"} where the 'xxx' is the name of the person. Just FYI there are about
29k of these 'Ref' fields in my book. But no matter how many times I try to
Find/Replace using "Error! Reference not found." with nothing - these 'ref'
fields will not stay gone. Is there another way to try and delete all these
ref fields other than a macro? Thanks again for your help.
 
J

Jay Freedman

When you toggle the fields, is there actually a word REF within the field code?
(Upper/lower case is not important, only that the letters appear.)

If that's the case, you can use the Replace dialog. First make sure the field
codes are visible. Then open the Replace dialog, type

^19 ref

in the Find What box (with a space after the 9 as shown), leave the Replace With
box empty, and click the Replace All button.

If the field codes don't contain the word REF, then the only remaining course of
action is to use the same Replace but search for just the code

^19

That will remove _all_ fields in the body of the text, including ones that you
might want to keep.
 
D

dougmcr8

Hi Jay - Well My Friend you solved it. But with one little twist. I could not
get a replace function going with the space between the number 9 and 'ref'.
When I had no space I got the required 29k replacements. I'm good now. What a
relief. I don't think I'll run the Indexing Automark for a while. Thanks so
very much. Doug
 
J

Jay Freedman

Congratulations, and thanks for letting us know what worked.

When you insert a field through the Fields dialog, it puts a space character
between the opening brace and the keyword, and a space just before the closing
brace. Normally, you need the first space in the search term to get any matches.

Whatever mishap changed your XE fields to REF fields apparently removed the
space. When things go wrong on the weird side, there's no telling just what the
result will be.
 
G

Glenn Borchardt

I'm using Vista and MS Office 2007 on a previously built Word 97 doc [about
1m characters]. For several months all was fine. All of the sudden, when
trying to print one day, once the print cycle started, the "Error! Bookmark
not found." appeared in every place where there should be an automark entry
for an Index. This error message also prints. I don't think I ever added a
"Bookmark" anywhere in my 365 pages. I tried re-indexing with my source file
and a new Index appears normally. But this does not eliminate this "Error!
Bookmark not found." problem. Any ideas? Thanks very much.
Index marking is done with fields -- they should be XE fields, which are
automatically marked as Hidden text.
The "default" field type is a REF field; if the first word in the fieldcode
isn't recognized as one of the special field keywords, then Word assumes that
the code is the name of a bookmark that it should refer to. The error message
you see is what a REF field displays when there is no bookmark with the"name"
in the field code.
What has apparently happened to your document is that all the XE fieldshave
been damaged in some way so they aren't recognized as XE or any of the other
known keywords, so they're assumed to be REF fields referring to nonexistent
bookmarks. I don't know how that may have happened.
Right-click any of the error messages and choose Toggle Field Codes. What do you
see within the braces? Look at a number of them. Depending on how uniform these
broken codes are, it may be possible to remove them with a properly constructed
Replace command.
Jay - Thanks much. I toggled a sample and they all look like an Automark
entry should look [when Show/Hide is not on], i.e. { "Word" }. So if you can
remind me how to replace every one of those several thousand entries during a
single Find/Replace operation then I'll try to insert a new Index and see
what happens. Appreciate the assist here.

A field code that looks like { "Word" } is _not_ what a marked index entry
should look like -- it should have an XE keyword at the start.

Be that as it may, I was trying to see whether the codes of these damaged fields
contained a common portion that the Replace could search for, but it lookslike
the answer is no. That means the solution needs to be programmed as a macro with
more intelligence than a simple Replace.

Follow the instructions inhttp://www.gmayor.com/installing_macro.htmto paste
the following macro into the VBA editor, in your Normal template.

Sub DeleteBadRefs()
    Dim idx As Long
    Dim oFld As Field
    For idx = ActiveDocument.Fields.Count To 1 Step -1
        Set oFld = ActiveDocument.Fields(idx)
        With oFld
            If .Type = wdFieldRef And _
             InStr(.Result, "Error!") Then
               .Delete
            End If
        End With
    Next
End Sub

This macro examines each field in the document. If the field is a Ref field that
displays an error message, it deletes that field.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.- Hide quoted text -

- Show quoted text -

Jay:

Thanks so much! Your macro did the trick instantaneously. You might
want to add it to the Word help section.

Glenn Borchardt
 

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