jdsmith_xyz
New Member
- Joined
- Apr 5, 2021
- Messages
- 1
- Office Version
- 2019
- Platform
- Windows
In an older thread, this code was recommended to open "Queries and Connections":
This works sometimes for me, but not right after opening the file. On the first run after opening, a Queries and Connections window becomes visible that is locked to single column width and has no visible content. I need to let my macro run to completion (can be lengthy) or ESC out of it. The column gets wider when the macro stops and existing queries become visible. When I restart, the column usually snaps to my specified width.
I can repro this by creating a new macro sheet and adding the above single macro routine and calling it directly. I can also modify the code to toggle the window on and off, but the locked column aspect persists. Does anyone have ideas on what might be causing this?
VBA Code:
Sub OpenQueriesPane()
Application.CommandBars("Queries and Connections").Visible = True
Application.CommandBars("Queries and Connections").Width = 400 'Change width as suits.
End Sub
This works sometimes for me, but not right after opening the file. On the first run after opening, a Queries and Connections window becomes visible that is locked to single column width and has no visible content. I need to let my macro run to completion (can be lengthy) or ESC out of it. The column gets wider when the macro stops and existing queries become visible. When I restart, the column usually snaps to my specified width.
I can repro this by creating a new macro sheet and adding the above single macro routine and calling it directly. I can also modify the code to toggle the window on and off, but the locked column aspect persists. Does anyone have ideas on what might be causing this?