Results 1 to 3 of 3

Thread: Command Bar Width Property

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Rep Power
    0

    Command Bar Width Property

    Hi,
    I am trying to setup an add-in of Excel using the below code. its a sample code of only 4 buttons, however I am using more than 30 buttons on this ribbon. The problem I am facing is about the width of the Command bar, which I am not able to wrap on multiple rows, even using the width property of the command bar.

    Please help me on this, if I am doing something wrong in this code.

    Thanks,
    Vitesh


    Private Sub Workbook_Open()
    Application.ScreenUpdating = False

    On Error Resume Next
    Dim cbToolBar As CommandBar
    Application.CommandBars("RSA Generic Add-in").Delete
    Application.CommandBars("Vitesh").Delete
    On Error GoTo 0
    csToolbarName = "RSA Generic Add-in"
    Set cbToolBar = Application.CommandBars.Add(csToolbarName, msoBarFloating, True, True)

    With cbToolBar
    Set ctButton1 = .Controls.Add(Type:=msoControlButton, ID:=2950)
    Set ctButton2 = .Controls.Add(Type:=msoControlButton, ID:=2950)
    Set ctButton3 = .Controls.Add(Type:=msoControlButton, ID:=2950)
    Set ctButton4 = .Controls.Add(Type:=msoControlButton, ID:=2950)
    .Visible = True
    .Width = 60

    End With

    With ctButton1
    .Style = msoButtonIconAndCaption
    .Caption = "Random Colors"
    .FaceId = 1763
    .OnAction = "SetPicklist"
    End With

    With ctButton2
    .Style = msoButtonIconAndCaption
    .Caption = "&UnHide Sheet Tabs" '& vbCr & "This will UnHide the Sheet Tabs, if hidden"
    .FaceId = 246
    .OnAction = "SetDefaults"
    End With

    With ctButton3
    .Style = msoButtonIconAndCaption
    .Caption = "&Hide Sheet Tabs"
    .FaceId = 244
    .OnAction = "SetDefaults1"
    End With

    With ctButton4
    .Style = msoButtonIconAndCaption
    .Caption = "&Sheet Visibility"
    .FaceId = 2174
    .OnAction = "VisibilitySettings"
    End With
    End Sub

  2. #2
    Junior Member tenda's Avatar
    Join Date
    May 2014
    Posts
    3
    Rep Power
    0
    with width, Try to set the height too.
    Code:
      .Height = barHeight * 2

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Rep Power
    0
    Thanks for replying Tenda, I Tried to set the height as well, but nothing changed...

Similar Threads

  1. Adjust The Width Of Column Chart Series
    By rich_cirillo in forum Excel Help
    Replies: 6
    Last Post: 07-05-2013, 06:08 PM
  2. Replacement for the Flawed UsedRange Property
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 9
    Last Post: 12-04-2012, 08:09 PM
  3. Using property ColorScaleCriteria color you cells
    By Rasm in forum Download Center
    Replies: 0
    Last Post: 12-04-2011, 09:20 PM
  4. Adding A Menu Bar To A User Form
    By Rasm in forum Excel Help
    Replies: 14
    Last Post: 05-05-2011, 04:05 AM
  5. Hide Ribbon and Formula Bar
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 04-21-2011, 07:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •