Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code to open links

2 views
Skip to first unread message

Greg H.

unread,
Aug 28, 2007, 5:34:01 PM8/28/07
to
Is there a set of code i can enter into a document that will open all linked
documents. I don't want to just update but actually open all documents
linked to the main document. Is there a way to do this? Thanks

Tom Ogilvy

unread,
Aug 28, 2007, 6:10:02 PM8/28/07
to
Place code like this in the Thisworkbook module of your workbook

Private Sub Workbook_Open()
Dim alinks as Variant
aLinks =ThisWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
on Error Resume Next
Application.workbooks.Open alinks(i)
if err.number <> 0 then _
msgbox alinks(i) & " could not be opened"
on Error goto 0
Next i
End If
Thisworkbook.Activate
End Sub


Placed in the Workbook_Open event.

--
Regards,
Tom Ogilvy

0 new messages