Hi Jay:
On the first subject, I didn't mean to be negative, but the bitmap size
speeds editing by a lot for this document as well as improving stability.
I've had many huge documents with no problems like this one, this is an
extremely linked document with 200 pages and on each page from 1 to 25
bitmaps - all linked to Excel..
I wrote a macro to try to do the update, but my vocabulary of VB methods is
not extensive. I did the following:
Sub UpdateLink()
'
' UpdateLink Macro
' Macro recorded 12/22/2003 by Scott Brown
'
Selection.HomeKey Unit:=wdStory
ActiveWindow.View.ShowFieldCodes = True
counter = 0
Selection.Find.ClearFormatting
With Selection.Find
.Text = "LINK Excel.Sheet.8 C:\\PPTFinal\\BOC_Fin.xls"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do
Selection.Find.Execute
If Selection.Find.Found = True Then Selection.Fields.Update
If Selection.Find.Found = True Then counter = counter + 1
'
Loop While Selection.Find.Found = True
'
MsgBox "This procedure found " & counter & " links to BOC_Fin.xls"
Selection.HomeKey Unit:=wdStory
ActiveWindow.View.ShowFieldCodes = False
End Sub
It didn't work because when the bitmap is not shown in graphic mode
(ActiveWindow.View.ShowFieldCodes = True), the links are not updated. Also,
for some reason, the counter seems to count pages instead of links and it
stops on page 162, instead of going to the end. I don't know why and I
didn't debug further because it didn't work. I spent a little time looking
for the correct method to find the next linked object (in ShowFieldCodes =
False mode) but decided that the problem is likely memory related and I
started to pursue that in betweeen the pressures of getting the document
finished.
When this procedure is run twice, Word becomes unstable. The top of the
word frame with the document file name turns to garbage and the task pane
graphics stop being updated. After a few more manual "update links" word
declares that the link cannot be found. If it gives that statement when the
bitmap is shown, the link is deleted and the bitmap becomes static and
unlinked. This is clear evidence of a program bug - a memory leak. I've
done a lot of C/C++ and assembly language programing. This is real clear
evidence that some procedure is allocating memory and not releasing it until
you exit the program, even though the procedure is finished. I looked for
..tmp files being created, as you mentioned and couldn't find any except when
word or excel is opened.
I tried the update links on print under Tools > Options > Print Tab > Update
Links checkbox. If I do a print to PDF with the Acrobat plugin, the result
is garbage. All the page numbers in the TOC area are XI and all the page
numbers in the main document are either the same or they stop at some page
number and the remainder of the doc has the same page number on each page.
All the bitmaps beyond a certain point in the document are blank rectangles.
If I try to edit the document, ALL of the menu items for
Edit/View/Insert/Fomat/Tools/Table are grayed out. The document size drops
to ~9.5 Mb from its current ~59 Mb, likely from the missing bitmaps.. In
other words, that operation destroys the document.
If you can point me to a procedure that will cycle through the bitmaps, that
would be a good workaround. You can't change back to ShowFieldCodes = False
after finding the link in the procedure above because the selection is
broken when that step is taken, from trying it manually. Do you file bug
reports to the Microsoft development team?
Thanks for all your help.
Scott
Jay Freedman said:
Hi, Scott,
I'm really happy you got a positive result. It'll go into my bag of
tricks. You just never know what'll work and what won't... there are
so many variables, such as just how many links there are and exactly
what they link to.
Don't ever tell John McGhie, the MVP whom I quoted, that he never
worked with "truly professional sized documents" -- that's all he
does, including some multi-thousand-page monsters. Anyway, I think
John was writing about editing/saving *speed* rather than stability
when he said the cache doesn't make any difference.
For your remaining problem, there may be a solution. Can you get
through updating the whole document if you only update part of it at a
time, say 100 links, then save, and repeat ad nauseam? If so, we can
probably automate that with a macro.