Consulting

Results 1 to 5 of 5

Thread: Update Links question

  1. #1
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location

    Update Links question

    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.

  2. #2
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,192
    Location
    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
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  3. #3
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    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.

  4. #4
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,192
    Location
    I only use 2007 at work and home

    Wouldn't AskToUpdatelinks be saved at workbook level, the same as "Visible" and so on?
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2403, Build 17425.20146

  5. #5
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    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.
    Be as you wish to seem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •