Queries and Connections Pane via VBA?

Matt Allington

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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

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

Forum statistics

Threads
1,089,489
Messages
5,408,565
Members
403,215
Latest member
DblDocWhitaker

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top