Refreshing ListObject

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,362
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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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