S
Scott
Hi:
I have a doc that explains my financial projections. I used linked bitmaps
from Excel because they resize and look the best in the document, compared
to any other format. Once the document has many of these objects it becomes
unstable.
I was able to reproduce the problem by simply creating a doc with a couple
hundred pages of a single Excel Object, 37 Rows By 12 Colums. I did a paste
special > paste link > bitmap. I then did edit > links and set it to manual
update. I then resized the object so that it fits on a std landscape page
with 0.9" margins all around. I put headers (heading 1 only) and page
numbers in to mimic my doc. I copied the bitmap along with a page break and
the header and pasted it 200 times to create a 200 page doc, similar to
mine. I then created a TOC of all the Header 1s to mimic my doc and put the
toc and bitmaps in separate sections with a restart page number at the new
section with the 200 bitmaps. Everything looks great. Save the doc,
reopen word, its all there and looking just great as it did.
Now, Either using edit > links > .... mark all ... > update links. After
about 40-50 links all the rest of the links are trashed with Error! Not a
valid link. This is similar to the action in my own doc. If I do the link
updates manually (Mark Object > Right Click > Update Link) until Word
becomes unstable, exit Word and continue, the problem doesn't usually occur
if I catch it in time. But this is extremely tedious. Also, using the
following Macro, the same problem occurs. This is with XP and Office XP
2002 with all the SPs and updates. I can send the sample doc and Excel file
to demonstrate this problem if necessary. (Too big, even zipped for this
newsgroup).
Can someone please help???? Thanks.
Scott
Here's the Macro:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub UpdateLink2()
Dim oRg As Range 'Document Range
Dim oFld As Field 'Fields to Update
Dim nCount As Long 'Field Counter
Set oRg = ActiveDocument.Range 'Set the Range to the Document
With oRg.Find 'Set up the Search-Find operation
.ClearFormatting
.Forward = True
.Format = False
.Wrap = wdFindStop
.Text = "^g" ' graphic
Do While .Execute
oRg.MoveEnd unit:=wdCharacter, Count:=1 'Move Range Forward One
Character
If oRg.Fields.Count > 0 Then
Set oFld = oRg.Fields(1)
If oFld.Type = wdFieldLink Then ' If the found field has a
link...
oFld.Update ' Update it
Sleep 300 ' Give it time to update
nCount = nCount + 1 ' Count the instances found
If nCount Mod 25 = 0 Then ' Every n updates ...
'ActiveDocument.Save ' Save the document
StatusBar = "Updated " & nCount & " fields" ' Show
the updates on Status bar
End If
End If
End If
' prepare to look for next field
oRg.Collapse wdCollapseEnd
Loop
End With
End Sub
I have a doc that explains my financial projections. I used linked bitmaps
from Excel because they resize and look the best in the document, compared
to any other format. Once the document has many of these objects it becomes
unstable.
I was able to reproduce the problem by simply creating a doc with a couple
hundred pages of a single Excel Object, 37 Rows By 12 Colums. I did a paste
special > paste link > bitmap. I then did edit > links and set it to manual
update. I then resized the object so that it fits on a std landscape page
with 0.9" margins all around. I put headers (heading 1 only) and page
numbers in to mimic my doc. I copied the bitmap along with a page break and
the header and pasted it 200 times to create a 200 page doc, similar to
mine. I then created a TOC of all the Header 1s to mimic my doc and put the
toc and bitmaps in separate sections with a restart page number at the new
section with the 200 bitmaps. Everything looks great. Save the doc,
reopen word, its all there and looking just great as it did.
Now, Either using edit > links > .... mark all ... > update links. After
about 40-50 links all the rest of the links are trashed with Error! Not a
valid link. This is similar to the action in my own doc. If I do the link
updates manually (Mark Object > Right Click > Update Link) until Word
becomes unstable, exit Word and continue, the problem doesn't usually occur
if I catch it in time. But this is extremely tedious. Also, using the
following Macro, the same problem occurs. This is with XP and Office XP
2002 with all the SPs and updates. I can send the sample doc and Excel file
to demonstrate this problem if necessary. (Too big, even zipped for this
newsgroup).
Can someone please help???? Thanks.
Scott
Here's the Macro:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub UpdateLink2()
Dim oRg As Range 'Document Range
Dim oFld As Field 'Fields to Update
Dim nCount As Long 'Field Counter
Set oRg = ActiveDocument.Range 'Set the Range to the Document
With oRg.Find 'Set up the Search-Find operation
.ClearFormatting
.Forward = True
.Format = False
.Wrap = wdFindStop
.Text = "^g" ' graphic
Do While .Execute
oRg.MoveEnd unit:=wdCharacter, Count:=1 'Move Range Forward One
Character
If oRg.Fields.Count > 0 Then
Set oFld = oRg.Fields(1)
If oFld.Type = wdFieldLink Then ' If the found field has a
link...
oFld.Update ' Update it
Sleep 300 ' Give it time to update
nCount = nCount + 1 ' Count the instances found
If nCount Mod 25 = 0 Then ' Every n updates ...
'ActiveDocument.Save ' Save the document
StatusBar = "Updated " & nCount & " fields" ' Show
the updates on Status bar
End If
End If
End If
' prepare to look for next field
oRg.Collapse wdCollapseEnd
Loop
End With
End Sub