PDA

View Full Version : Update Links question



stanl
07-07-2018, 06:11 AM
I may be basically behind the times on this, but I have used a generic function to either open or create a new Excel workbook which more or less set application properties, i.e. visible, screenupdating, user control, displayalert, and updatelinks. But now using Excel 2016 rather than 2010 it appears updatelinks is now a workbook property and the application object now has AskToUpdateLinks which is applied to Excel 2013 and greater.

I modified my function to check or application.version <15 but I think I will miss turning updating off at the application level, especially with extended updating for power query and power pivot.

Since I want to avoid the pop-up for link updating setting AskToUpdateLinks to false does that, but it also means any links are auto-updated.

Be nice if there was a .hasLinks property, or is this just a mountain/molehill I have created.

georgiboy
07-08-2018, 02:46 AM
Not sure if i fully understand what you need, the .HasLinks bit that made me think the below is what you need:

Sub HasLinks()

Dim lnk As Variant
lnk = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(lnk) Then
MsgBox "Has links"
Else
MsgBox "No links"
End If

End Sub

You could turn this into a function if required.

Hope this helps

stanl
07-08-2018, 04:47 AM
I had something similar, but yours is cleaner. Thank you. I think my question was a bit sloppy. I was assuming that in versions pre-2013 setting UpdateLinks at the application level would cover any and all workbooks opened for that instance prior to opening them. But AskToUpdateLinks at the workbook level appears to imply that it must be set for each workbook. I guess I need to test it with workbooks with/without links. My confusion is if AskToUpdatelinks is a workbook property doesn't that mean it cannot be set until the workbook is opened, and so if it has links isn't the default to ask to prompt to update them - which kind of makes the property a bit worthless.

georgiboy
07-09-2018, 05:18 AM
I only use 2007 at work and home :(

Wouldn't AskToUpdatelinks be saved at workbook level, the same as "Visible" and so on?

Aflatoon
07-09-2018, 05:58 AM
I'm confused. The Application object doesn't have an UpdateLinks property in 2010 (it applied to the Workbook then too), but does have AskToUpdateLinks.