'Excel VBA - Unable to change width of docked "Queries & Connections"
I'm trying to programmatically open "Queries & Connections" CommandBar. It's by default docked to the right (msoBarRight)
However, just setting .Visible = True opens it too narrow.
I tried to fix that by setting .Width but it just ignores it...
No problems if CommandBar is floating though.
I'm using Excel 365.
Example code below:
With Application.CommandBars("Queries and Connections")
.Visible = True
.Width = 350 'This part does nothing
End With
Solution 1:[1]
Enforcing dock on the right made .Width work for me. Any other .Position works as well, but if you want pane to stay docked on the right, this works:
With Application.CommandBars("Queries and Connections")
.Visible = True
.Position = msoBarRight
.Width = 400
End With
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rafał Andrzejczak |
