Queries and Connections Pane via VBA?

Matt Allington

MrExcel MVP
Joined
Dec 18, 2014
Messages
1,625
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
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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.
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
This is what I get
ExcelQueriesPane.jpg
 
Upvote 0
This worked for me:

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

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

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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