Stephen Spittal
New Member
Hello all,
I am using the code below to open all the linked sources for my excel spreadsheet
however on the line
I get a run-time error 13 type miss match
any help would be much apprecisated
I am using the code below to open all the linked sources for my excel spreadsheet
however on the line
Code:
For I = 1 to UBound(v)
I get a run-time error 13 type miss match
Code:
Sub UpdateLinks()
Dim v As Variant, i As Long
v = ThisWorkbook.LinkSources(XlLink.xlExcelLinks)
For i = 1 To UBound(v)
If Not FileInUse(v(i)) Then
Workbooks.Open (v(i))
End If
Next i
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
End Sub
Public Function FileInUse(sFileName) As Boolean 'Checks if a workbook is open
On Error Resume Next
Open sFileName For Binary Access Read Lock Read As #1
Close #1
FileInUse = IIf(Err.Number > 0, True, False)
On Error GoTo 0
End Function
any help would be much apprecisated