Excel Querries and connection pane - VBA not reacting as it should? or am I missing something?

Radoslaw Poprawski

Active Member
Joined
Jun 19, 2021
Messages
398
Office Version
  1. 365
Platform
  1. Windows
Hello,
Based on this thread:

Queries and Connections Pane via VBA?

from this forum i came up with this code:
VBA Code:
Private Sub Workbook_Open()
    
    BU_Matrix.Range("G2") = Year(Now()) & "_" & Right("0" & Month(Now()), 2) & "A"
    ActiveWorkbook.Connections("Query - MyQuery").Refresh
    
    Application.CommandBars("Queries and Connections").Visible = True
    Application.CommandBars("Queries and Connections").Position = msoBarRight
    Application.CommandBars("Queries and Connections").Width = 350
    
End Sub

and when I go step by step (f8) it works.
however when i save and close, then re-open i can clearly see the pane is openning but b4 its fullly visable it vanishes again and i do not l know why?
My second question how would I implement this code into personal.xlsb file so that with each excel file being open this code would run?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,836
Messages
6,127,173
Members
449,368
Latest member
JayHo

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