ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run-time error 1004: Method 'UpdateLink' (https://www.excelbanter.com/excel-programming/414184-run-time-error-1004-method-updatelink.html)

ChrisP

Run-time error 1004: Method 'UpdateLink'
 
When running this code in excel I am getting the following error:

Run-time error '1004':
Method 'UpdateLink' of object '_Workbook' failed

What's wrong? Here is the code I'm using:

Sub UpdateSelectedLinks()
Dim aLinks
Dim cLink As String
Dim i As Integer
Application.ScreenUpdating = False
aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
cLink = Split(aLinks(i), "\")(UBound(Split(aLinks(i), "\")))
If cLink < "MasterList.xls" Then
ActiveWorkbook.UpdateLink Name:=aLinks(i), Type:=xlExcelLinks
End If
Next i
End If
Application.ScreenUpdating = True
End Sub

When I choose to debug the row that's hightlighted is "
ActiveWorkbook.UpdateLink Name:=aLinks(i), Type:=xlExcelLinks"

HELP!!!

Thanks!



All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com