Refreshing ListObject

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,360
I've run into a curious problem.

Using Data-New Query - From Oracle Database, I've created an ODBC connection to oracle (with a SQL statement).
What I'd like to do is use VBA to force a refresh.

My current method is using SSIS to execute a "Macro"/subroutine which works until it gets an error.

The curious part is, if I manually use Data - Show Queries (and then close it), this code sample works.
When I do not manually (mouse and clicking) do this first, it fails.

Sheets("Data").Range("D8").Select
ActiveWorkbook.RefreshAll
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False

Using this below also fails until after the first time I've manually opened/closed the panel.
Application.CommandBars("Workbook Queries").Visible = True
Application.CommandBars("Workbook Queries").Visible = False

I'm sort of hoping there's something obvious and quick I'm just missing.

Mike
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top