Queries and Connections Pane via VBA?

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,260
I would like to be able to control the display and hiding of the Query and Connections pane in Excel 2016 (Power Query). I have tried to find the object using the macro recorder but the open/close event doesn't get recorded. Can anyone tell me if this is controllable, and if so, how?

Thanks

Matt
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Jerry Sullivan

MrExcel MVP
Joined
Mar 18, 2010
Messages
8,787
Hi Matt,

You could try this.

Code:
Application.CommandBars("Queries and Connections").Visible=True

On my system this adds the pane, but it is very narrow. I have very little experience with PowerQuery, so it could be I just don't have some other settings right to support that pane being properly displayed.
 

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,260
sorry for not replying earlier on this. Yes, this is exactly what I am after. And yes the pane is very narrow. I don't know if there is a setting for that or not.

Matt
 

ricardodiazjimenez

New Member
Joined
May 9, 2013
Messages
9
Hi, I'm using Excel 1807 (compilation 10325.20082) and when I use this code the pane opens, but is blank (used to work before). Does anybody know if there is something to be changed? anybody else with this problem?
 

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,260

ADVERTISEMENT

There was a change to the UI at some stage. The later versions have 2 separate panes with links at the top. One is connections and one is queries from memory.
 

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,260

ADVERTISEMENT

I don't think it changed. This is what I use

Sub WidenQueriesPane()
Application.CommandBars("Queries and Connections").Visible = True
Application.CommandBars("Queries and Connections").Width = 300
'Change width above to something that suits.
End Sub
 

ricardodiazjimenez

New Member
Joined
May 9, 2013
Messages
9
This is what I get
ExcelQueriesPane.jpg
 

celias

New Member
Joined
Oct 1, 2015
Messages
34
This worked for me:

Sub OpenQueriesPane()
Application.CommandBars("Workbook Queries").Visible = True
Application.CommandBars("Workbook Queries").Width = 400 'Change width as suits.
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,057
Messages
5,622,449
Members
415,895
Latest member
Akhilesh28

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
Top