Queries and Connections Pane via VBA?

Matt Allington

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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

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,201
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,201
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,201
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
 

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,089,931
Messages
5,411,327
Members
403,362
Latest member
DoubleJay

This Week's Hot Topics

Top