View Single Post
  #2   Report Post  
Ken Wright
 
Posts: n/a
Default

When you say 'all linked workbooks', do you mean all workbooks directly
linked to the current workbook, or every workbook in every link in every
workbook that is opened by the routine, ie if book a is linked to b, and b
to c and c to d and d to e etc, then by running the routine from a, you
would open b, c, d, e?

If you just want to open all workbooks with references in 'Edit Links'
within your activeworkbook, then how about:-

Sub OpenAllLinks()
Dim CurWkbk As Workbook
Dim arLinks As Variant
Dim intIndex As Integer
Set CurWkbk = ActiveWorkbook
arLinks = CurWkbk.LinkSources(xlExcelLinks)

If Not IsEmpty(arLinks) Then
For intIndex = LBound(arLinks) To UBound(arLinks)
CurWkbk.OpenLinks arLinks(intIndex)
Next intIndex
Else
MsgBox "The active workbook contains no external links."
End If
End Sub

Slight tweak on example straight out of help.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"noyb" wrote in message
...
Is it possible to write a macro which will open all linked workbooks
without hard coding the workbook names so as to make such a macro more
general?
Thanks