xangetzu
New Member
- Joined
- Oct 23, 2017
- Messages
- 3
Good afternoon. I have been trying to find a workaround for this, and am at the point of pulling my hair out.
I have what I consider to be a very simple macro. All it does is refresh a number of connections that are in my excel file. All of these connections are to the same access database. The original macro was a loop that handled all connections in the workbook, however as part of troubleshooting I separated it out to specifically reference each one and tried various things to see if I could pin point which connection is the problem, but have had little success. So far, I can determine that it fails on a random connection each time. It does not matter what order I refresh them in, and if I manually refresh them through the connections tab in Excel, they all refresh fine. I have also found that if I debug, and walk through each step, they will all eventually go. Sometimes it takes 5 or more attempts, but eventually hitting F5, and debug over and over will get it through the entire set.
I am using Excel 2013 pro. The Access database is located on the same drive as the excel file (in fact they are in the same directory)
The DoEvents, and message box lines were added to see if I could tease out anything specific. They are not really n
I have what I consider to be a very simple macro. All it does is refresh a number of connections that are in my excel file. All of these connections are to the same access database. The original macro was a loop that handled all connections in the workbook, however as part of troubleshooting I separated it out to specifically reference each one and tried various things to see if I could pin point which connection is the problem, but have had little success. So far, I can determine that it fails on a random connection each time. It does not matter what order I refresh them in, and if I manually refresh them through the connections tab in Excel, they all refresh fine. I have also found that if I debug, and walk through each step, they will all eventually go. Sometimes it takes 5 or more attempts, but eventually hitting F5, and debug over and over will get it through the entire set.
I am using Excel 2013 pro. The Access database is located on the same drive as the excel file (in fact they are in the same directory)
The DoEvents, and message box lines were added to see if I could tease out anything specific. They are not really n
Code:
Sub Refresh_Queries()
'
' Refresh_Queries Macro
'
'
' Keyboard Shortcut: Ctrl+Shift+R
'
Calculate
For Each objConnection In ThisWorkbook.Connections
objConnection.OLEDBConnection.BackgroundQuery = False
Next
ActiveWorkbook.Connections("Connection.Lineup").Refresh
DoEvents
MsgBox "Lineup refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.LPR CName Summary").Refresh
DoEvents
MsgBox "LPR refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.LTS A.CName Summary").Refresh
DoEvents
MsgBox "Agent LTS refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.LTS S.CName Summary").Refresh
DoEvents
MsgBox "Supervisor LTS refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.CXI CName Summary").Refresh
DoEvents
MsgBox "CXI Summary refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.CXI CName Surveys").Refresh
DoEvents
MsgBox "CXI Surveys refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.Ticket CName Cases").Refresh
DoEvents
MsgBox "Ticket Cases refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
ActiveWorkbook.Connections("Connection.Ticket CName Summary").Refresh
DoEvents
MsgBox "Ticket Summary refreshed. Continue to update Queries?", vbOKOnly, "Continue?"
Application.ScreenUpdating = True
MsgBox "Connections to C.L.O.U.D. finished. Continue to update Queries?", vbOKOnly, "Continue?"
End Sub
Last edited by a moderator: