I have given a button to the user to populate the data from sql oledb connections. That does the job so I can control when user should populate the data from query tables. My problem is, I have no way of blocking user pressing ‘Refresh All ‘ button from the ribbon.
Tried the following code in Public Sub Workbook_Open() '
'-- Turn off the Refresh Capability from Ribbon
For J = 1 To ActiveWorkbook.Connections.Count
With ActiveWorkbook.Connections(J).OLEDBConnection
.BackgroundQuery = False
.RefreshOnFileOpen = False
End With
'MsgBox ActiveWorkbook.Connections(J).Name
Next J
It doesn’t work. 'Refresh All' is still active and populates all worksheets.
Please let me know how to block ‘Refresh All’ from the ribbon or a way Not Refresh, when user presses that button.
Thanks.