Reply
 
Thread Tools Display Modes
  #1   Report Post  
bob
 
Posts: n/a
Default Help with Word Excel Link through Macro

Help, I am new to word macros and am trying to automate links between
word and excel on a project that will be turned over to others with
even less experience then me. My project has about 200 links although
I am thinking of breaking them up into smaller word docs to reduce the
amount of links. I have found that by having the linked (source)
spreadsheet open, this has sped up the process. I have the links set
to manual update as the spreadsheet has a habit of continuously running



even when I haven't changed anything with updates set to automatic
(seems like a good way to kill a hard drive).


My problem is that this code, which was taken from another posts, seems



to loop continuously and ends up with an 'insufficient memory' message
which causes the process to hang. Interestingly enough, the same
results happens with only 10 links on a test doc. If I update
manually{Edit / Links / Update}, then all works well and fast if I have



the excel source open at the time but I do not want to implement it
with a manual step like that.


The strangest part is that if I comment out the following statements,
then it seems to go through each field properly.
.Locked = False
.Update
.Locked = boolLinkState


Please help me. I'm sure it is my programming that is responsible but
can not find the answer. Also, can anyone point me to an online
reference manual for word 2002, excel 2002, or vba?


Pentium 4 w/ 512Mb cache
Operating system XP SP2
Word 2002
Excel 2002


Public Sub UpdateAllLinks()
Dim fldItem As Word.Field
Dim boolFieldLockState As Boolean
Dim boolLinkState As Boolean
fldcount = 0
' All fields in the MainTextStory
For Each fldItem In ActiveDocument.Fields


' Update any linked fields
If fldItem.Type = wdFieldLink Then


boolFieldLockState = fldItem.Locked
If boolFieldLockState Then fldItem.Locked = False


' Now try to update the linked fields
On Error Resume Next
With fldItem.LinkFormat
fldcount = fldcount + 1
If fldcount 90 Then
Stop
End If


boolLinkState = .Locked
.Locked = False
.Update
.Locked = boolLinkState
End With
On Error GoTo 0
fldItem.Locked = boolFieldLockState
End If
Next
End Sub

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 97 in Windows XP to maintain formatting Charlie''s Word VBA questions Microsoft Word Help 22 May 20th 23 08:51 PM
The WordPerfect "Reveal Codes" method is so much easier to use. Torden Microsoft Word Help 8 April 19th 10 07:50 PM
is word perfect compatible with office word? Noreen Microsoft Word Help 1 May 11th 05 11:17 PM
Extra space when pasting link from excel to word as unformatted te 0013 Microsoft Word Help 11 January 31st 05 06:17 PM
Excel Link: Adding rows in Excel does not add cells in Word Jameslp Tables 2 December 9th 04 07:18 PM


All times are GMT +1. The time now is 03:52 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"