+ Reply to Thread
Results 1 to 13 of 13

ActiveWorkbook.Connections().Refresh not working after version update

  1. #1
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    ActiveWorkbook.Connections().Refresh not working after version update

    Hi,

    I have several reports that I use to collect data from external data sources in a specific order. To update individual data connections I use VBA like this.

    Please Login or Register  to view this content.
    Capture2.PNG Capture3.PNG

    Since version upgrade to 1711 this does not work anymore but gives error "Run-time error '1004': Application-defined or object-defined error." In previous Excel versions this code works as intended. Seems that ActiveWorkbook.Connections().Refresh is not supported any more?

    What is this about and what should I do with this?

    Most of my environment is still in version 1708 (semi-annual channel), but I'm expecting this to become a real problem after next version upgrade.
    Last edited by bedullah; 01-29-2018 at 09:44 AM. Reason: Added screenshots

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Hi,

    Where are the UnprotectAllSheets and ProtectAllSheets routines located- in the same workbook? Does every connection fail to refresh with the same error, or only the first one (I note that you have spelled "parameters" differently in the first one)?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Try this
    - each connection should have 0 (zero) against it in the message box
    - 9 indicates that the connection cannot be found (error in name perhaps)

    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    The protection has nothing to do with the problem. I have tested that. It has something to do with different kind of connection object in Excel 2016 after version 1711.

  5. #5
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Quote Originally Posted by kev_ View Post
    Try this
    - each connection should have 0 (zero) against it in the message box
    - 9 indicates that the connection cannot be found (error in name perhaps)

    Please Login or Register  to view this content.
    All seems to be 0

    Capture.PNG

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    t has something to do with different kind of connection object in Excel 2016 after version 1711.


    I am not convinced
    - I am on 1712 and your code works
    - specifically this method is usable
    Please Login or Register  to view this content.

    Are you able to update the connections manually?
    If you can then try this:
    - update each one manualy
    (update them all)
    - save and close the workbook
    - open the workbook
    - run the VBA

    I have experienced a similar problem (not with connections) and Excel magically fixed itself

  7. #7
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Quote Originally Posted by kev_ View Post


    I am not convinced
    - I am on 1712 and your code works
    - specifically this method is usable
    Please Login or Register  to view this content.

    Are you able to update the connections manually?
    If you can then try this:
    - update each one manualy
    (update them all)
    - save and close the workbook
    - open the workbook
    - run the VBA

    I have experienced a similar problem (not with connections) and Excel magically fixed itself
    Yes you are right. I tested it with a single connection and it works. This is weird. It must be some compatibility issue. Using my report I was not even able to record a macro that would update my connection. But with a new workbook I can.

  8. #8
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Connection handling changed in version 1711 (compared to 1708). They now have the Queries and Connections button and connections are visible in the right side of the worksheet. Previously there was only "Connections" button and connections opened in a separate window.

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    My next suggestion was going to be to try a new workbook - in case the old one was corrupted
    If you are lucky, your problem may be restricted to only one workbook

  10. #10
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    Seems that when I recreate the connection object using Data->Existing Connections->"Comments" (open). It creates a new connection "Comments1". Now there is no problem refreshing this connection through VBA.

    Now when thinking of this is may be that these problematic connections are of a kind that have originally been created with very old Excel version (2003 or so). At that time I guess there was no table objects even or at least they were not used for external data.

    It may be that I have to fix these problematic connections to all my reports (which sucks). I'm still continuing to investigate this further...
    Last edited by bedullah; 01-29-2018 at 09:35 AM.

  11. #11
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    I think you are correct

  12. #12
    Registered User
    Join Date
    01-29-2018
    Location
    Finland
    MS-Off Ver
    O365 ProPlus
    Posts
    7

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    When testing, for some connections just creating a table object of them helps to fix the issue. Some have to be recreated but it's fairly easy using the same connection object to create a new one. This is quite interesting problem and came out of nowhere! Anyway I think I know what to do now. And regarding the version issue I'm sure this really has something to do with changes in connection handling somewhere between 1708 and 1711 versions. They must have removed support for very old kind of connections (pre excel 2007) where table objects were not used but only external data ranges. I don't think you can even create these external data ranges any more.

    Thank you all! I'll mark this solved now.

  13. #13
    Registered User
    Join Date
    12-28-2011
    Location
    KS
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: ActiveWorkbook.Connections().Refresh not working after version update

    I had this same problem and was able to fix it by changing my filetype to xlsm from xls.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Refresh All vs. Refresh All Data Connections
    By TK92 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-22-2016, 09:14 AM
  2. Formulas not working in higher version, 2010 Version to 2013 version
    By thilag in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-19-2015, 09:09 PM
  3. Replies: 3
    Last Post: 02-23-2015, 12:33 AM
  4. Is the only way to 'close' an ActiveWorkbook.Connections to delete it?
    By trgz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2015, 09:46 AM
  5. [SOLVED] Wait for update (refresh not working)
    By jik_ff in forum Access Tables & Databases
    Replies: 1
    Last Post: 07-18-2014, 10:33 AM
  6. Activeworkbook.Refreshall skips some connections
    By Phillip.C in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-05-2014, 10:34 AM
  7. [SOLVED] Jet / Ace DB connections. Multi version application (2007 - 2013)
    By BellyGas in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-26-2014, 05:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1