macros

C

cbcammarata

I have several Excel-linked objects (tables) in my word document, and want to
create a macro to update all objects at once. However, once I start recording
the macro, it will not allow me to right click on the object to "update
link". Anyone know how to do this?
 
C

CyberTaz

Correct - that is expected behavior. The mouse is unusable in the document
while recording. Anything within the boundaries of the Scroll Bars, Rulers &
Status Bar are off limits. You must use the Menu commands or keyboard
equivalents. Likewise, the mouse can't be used to navigate or select text
while the recorder is active.
 
G

Graham Mayor

You wouldn't - the macro recorder's limitations would not allow such a macro
to be recorded. However what you ask is simple enough. The following should
update only the Excel links. If you want to update all the fields (links are
fields) then use the sample code at
http://www.gmayor.com/installing_macro.htm

Sub UpdateExcelLinks()
With ActiveDocument
For i = .Fields.Count To 1 Step -1
With .Fields(i)
If .Type = wdFieldLink Then
If InStr(1, .Code, "Excel") <> 0 Then
.Update
End If
End If
End With
Next i
.Save
End With
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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