?
Solved

Updating Links

Posted on 2011-03-15
11
Medium Priority
?
267 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35137422
Are you sure the path is correct? Can you update the link manually?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35137432
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
 

Author Comment

by:Seamus2626
ID: 35138453
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35138468
Sorry - that should be Arrlinks(I)
I must have been messing around with it some time and accidentally saved it!
0
 

Author Comment

by:Seamus2626
ID: 35138695
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
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35138724
Looks ok. What do you mean by not updating - getting an error in the code or the value just not changing?
0
 

Author Comment

by:Seamus2626
ID: 35138748
Value not changing.......
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35138769
Does it work if you update it manually using the Edit Links dialog?
0
 

Author Comment

by:Seamus2626
ID: 35138810
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
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 35138829
You know you are subtracting 1 from the count in your formula, right? ;)
0
 

Author Closing Comment

by:Seamus2626
ID: 35139104
Had the link named incorrectly, thanks!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question