CommandBar Resize
I have created a floating commandbar with 3 buttons.
When it shows, the shape defaults to 1 button deep by 3 wide. I can change the shape on screen by using the mouse to show 3 deep by 1 wide but how can I programatically do this? It's like doing a wrapround, squeeze the width and increase the height. '.Height' resizes the buttons ok but does not work on the bar. I'd appreciate any views. T.I.A purple |
CommandBar Resize
"purple" wrote in message
... I have created a floating commandbar with 3 buttons. When it shows, the shape defaults to 1 button deep by 3 wide. I can change the shape on screen by using the mouse to show 3 deep by 1 wide but how can I programatically do this? It's like doing a wrapround, squeeze the width and increase the height. '.Height' resizes the buttons ok but does not work on the bar. I'd appreciate any views. Hi Purple, If you set the Width property of your command bar to the width of one button, the buttons should stack automatically. The width of a standard command bar button is 39, so the following should do the trick: CommandBars("YourBarName").Width = 39 -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
CommandBar Resize
Thanks fo rthe reply but I must be missing something. No
matter what value I set it doesn't seem to make any difference. This is the code I'm using: Option Explicit Option Private Module Sub InstallFloatingMenu() Dim floatbar, button1, button2, button3 On Error Resume Next Application.CommandBars("Edit Income Parameters").Delete On Error GoTo 0 'Create floating menu bar and set initial position to avoid editing form Set floatbar = CommandBars.Add("Edit Income Parameters", Position:=msoBarFloating) With floatbar .Left = 20 .Top = 200 .Width = 39 End With 'Add buttons and properties Set button1 = floatbar.Controls.Add(msoControlButton) With button1 .Width = 65 .Style = msoButtonIconAndCaption .Caption = "Open" .FaceId = 23 .OnAction = "FrmInitialise" End With Set button2 = floatbar.Controls.Add(msoControlButton) With button2 .Width = 85 .Style = msoButtonIconAndCaption .Caption = "Minimise" .FaceId = 317 .OnAction = "FrmMinimise" End With Set button3 = floatbar.Controls.Add(msoControlButton) With button3 .Width = 85 .Style = msoButtonIconAndCaption .Caption = "Restore" .FaceId = 316 .OnAction = "FrmMaximise" End With floatbar.Visible = True End Sub purple -----Original Message----- "purple" wrote in message ... I have created a floating commandbar with 3 buttons. When it shows, the shape defaults to 1 button deep by 3 wide. I can change the shape on screen by using the mouse to show 3 deep by 1 wide but how can I programatically do this? It's like doing a wrapround, squeeze the width and increase the height. '.Height' resizes the buttons ok but does not work on the bar. I'd appreciate any views. Hi Purple, If you set the Width property of your command bar to the width of one button, the buttons should stack automatically. The width of a standard command bar button is 39, so the following should do the trick: CommandBars("YourBarName").Width = 39 -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm . |
CommandBar Resize
Hi Rob
Got it. I can only set the width after the bar has been made visible!! Yeah :) :0 Many Thanks -----Original Message----- Thanks fo rthe reply but I must be missing something. No matter what value I set it doesn't seem to make any difference. This is the code I'm using: Option Explicit Option Private Module Sub InstallFloatingMenu() Dim floatbar, button1, button2, button3 On Error Resume Next Application.CommandBars("Edit Income Parameters").Delete On Error GoTo 0 'Create floating menu bar and set initial position to avoid editing form Set floatbar = CommandBars.Add("Edit Income Parameters", Position:=msoBarFloating) With floatbar .Left = 20 .Top = 200 .Width = 39 End With 'Add buttons and properties Set button1 = floatbar.Controls.Add(msoControlButton) With button1 .Width = 65 .Style = msoButtonIconAndCaption .Caption = "Open" .FaceId = 23 .OnAction = "FrmInitialise" End With Set button2 = floatbar.Controls.Add(msoControlButton) With button2 .Width = 85 .Style = msoButtonIconAndCaption .Caption = "Minimise" .FaceId = 317 .OnAction = "FrmMinimise" End With Set button3 = floatbar.Controls.Add(msoControlButton) With button3 .Width = 85 .Style = msoButtonIconAndCaption .Caption = "Restore" .FaceId = 316 .OnAction = "FrmMaximise" End With floatbar.Visible = True End Sub purple -----Original Message----- "purple" wrote in message ... I have created a floating commandbar with 3 buttons. When it shows, the shape defaults to 1 button deep by 3 wide. I can change the shape on screen by using the mouse to show 3 deep by 1 wide but how can I programatically do this? It's like doing a wrapround, squeeze the width and increase the height. '.Height' resizes the buttons ok but does not work on the bar. I'd appreciate any views. Hi Purple, If you set the Width property of your command bar to the width of one button, the buttons should stack automatically. The width of a standard command bar button is 39, so the following should do the trick: CommandBars("YourBarName").Width = 39 -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm . . |
CommandBar Resize
"purple" wrote in message
... Hi Rob Got it. I can only set the width after the bar has been made visible!! Yeah :) :0 Hi Purple, Sorry, I should have made that clear. Glad you figured it out! -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
CommandBar Resize
01/04/2005 21:30:44
Rob Bovey wrote in message "purple" wrote in message ... I have created a floating commandbar with 3 buttons. When it shows, the shape defaults to 1 button deep by 3 wide. I can change the shape on screen by using the mouse to show 3 deep by 1 wide but how can I programatically do this? It's like doing a wrapround, squeeze the width and increase the height. '.Height' resizes the buttons ok but does not work on the bar. I'd appreciate any views. Hi Purple, If you set the Width property of your command bar to the width of one button, the buttons should stack automatically. The width of a standard command bar button is 39, so the following should do the trick: CommandBars("YourBarName").Width = 39 -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
All times are GMT +1. The time now is 03:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com