Updating Links

Hi,

I have some code here to run a report. I get stuck though when i tyry to update a link i.e.

ActiveWorkbook.UpdateLink Name:= _
        "\\ukhibmdata02\rights\Asset Services Risk Team\Cash Nostros\Asset Services Outstanding Cash Items.xls", Type _
        :=xlExcelLinks


I get the error messsage. "Method update of link failed"

Can anyone advise where im going wrong

Thanks
Seamus
Sub RunReport()
Call RunReportDataSource


Application.DisplayAlerts = False


Dim objSht
   
   
   For Each objSht In ActiveWorkbook.Sheets
      objSht.Visible = xlSheetVisible
   Next objSht

Call Module7.Macro2
Call Autofill
Call Module7.DeleteRecordsRawData
Call Module7.ChangeFormula
Call Module7.DeleteRecordsYesterday
Call AllWorkbookPivots
Call HighlightTotals
Call FutureValues
Call Module5.Macro1
Call DollarsAndNumbers
Call ShrinkSheet
Call SendTotals


Sheets("Daily Dash").Visible = False
Sheets("Chart").Visible = False
Sheets("T-2").Visible = False
Sheets("Raw Data").Visible = False
Sheets("Check").Visible = False
Sheets("Screen").Select

    ActiveWorkbook.UpdateLink Name:= _
        "\\ukhibmdata02\rights\Asset Services Risk Team\Cash Nostros\Asset Services Outstanding Cash Items.xls", Type _
        :=xlExcelLinks

Application.DisplayAlerts = True


MsgBox "Report Complete, Create File"
Call Msbox

End Sub

Open in new window

Seamus2626Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rory ArchibaldConnect With a Mentor Commented:
You know you are subtracting 1 from the count in your formula, right? ;)
0
 
Rory ArchibaldCommented:
Are you sure the path is correct? Can you update the link manually?
0
 
Rory ArchibaldCommented:
PS If you want to update all links, you can use something like this rather than hardcoding file paths:
Sub UpdateFileLinks()
   Dim arrLinks, I As Long
   arrLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
   If Not IsEmpty(arrLinks) Then
      For I = LBound(arrLinks) To UBound(arrLinks)
        ActiveWorkbook.UpdateLink arrLinks(3)
      Next I
   End If
End Sub

Open in new window

0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
Seamus2626Author Commented:
Thanks Rory, i think il go with updating the all links

I get Subscript out of range on the following though

ActiveWorkbook.UpdateLink arrLinks(3)

Cheers,
Seamus
0
 
Rory ArchibaldCommented:
Sorry - that should be Arrlinks(I)
I must have been messing around with it some time and accidentally saved it!
0
 
Seamus2626Author Commented:
Cheers Rory, thats not updating

here is my actual link

=COUNT('\\Ukhibmdata02.hbeu.adroot.hsbc\rights\Asset Services Risk Team\Cash Nostros\[Asset Services Outstanding Cash Items.xls]Outstanding Items Report-1'!$H:$H)-1

Is there something up with that?

Thanks
Seamus
0
 
Rory ArchibaldCommented:
Looks ok. What do you mean by not updating - getting an error in the code or the value just not changing?
0
 
Seamus2626Author Commented:
Value not changing.......
0
 
Rory ArchibaldCommented:
Does it work if you update it manually using the Edit Links dialog?
0
 
Seamus2626Author Commented:
Just been trying that. Nope. When i highlight the whole of Col A, it says 896. Back in the cell in my other WB it says 895, even though ive manually updates the link......
0
 
Seamus2626Author Commented:
Had the link named incorrectly, thanks!!
0
All Courses

From novice to tech pro — start learning today.