+ Reply to Thread
Results 1 to 2 of 2

Custom toolbars (not again!!!)

  1. #1
    Sharon
    Guest

    Custom toolbars (not again!!!)

    Hi

    You've helped so much with this but I am going wild with frustration. I
    copied your code exactly and it is creating a toolbar and button on the fly.
    But I want the button to display text and am using the following code. But
    it is just showing a blank button? It runs the macro fine and the tool tip
    shows. Any help would be really, really appreciated!!

    Sub make_menu()
    Dim cbar As CommandBar
    Dim cbarcontrol As CommandBarControl
    'delete the previous version if it exists
    Call delete_menu

    Set cbar = Application.CommandBars.Add(Name:="tester", temporary:=True)

    cbar.Visible = True
    cbar.Position = msoBarTop

    Set cbarcontrol = cbar.Controls.Add(Type:=msoButtonCaption)
    With cbarcontrol
    .Caption = "All"
    .OnAction = "All"
    .Visible = True

    End With
    End Sub
    --
    Sharon

  2. #2
    Tom Ogilvy
    Guest

    RE: Custom toolbars (not again!!!)

    Set cbarcontrol = cbar.Controls.Add(Type:=msoButtonCaption)
    should be

    Set cbarcontrol = cbar.Controls.Add(Type:=msoControlButton)


    --
    Regards,
    Tom Ogilvy



    "Sharon" wrote:

    > Hi
    >
    > You've helped so much with this but I am going wild with frustration. I
    > copied your code exactly and it is creating a toolbar and button on the fly.
    > But I want the button to display text and am using the following code. But
    > it is just showing a blank button? It runs the macro fine and the tool tip
    > shows. Any help would be really, really appreciated!!
    >
    > Sub make_menu()
    > Dim cbar As CommandBar
    > Dim cbarcontrol As CommandBarControl
    > 'delete the previous version if it exists
    > Call delete_menu
    >
    > Set cbar = Application.CommandBars.Add(Name:="tester", temporary:=True)
    >
    > cbar.Visible = True
    > cbar.Position = msoBarTop
    >
    > Set cbarcontrol = cbar.Controls.Add(Type:=msoButtonCaption)
    > With cbarcontrol
    > .Caption = "All"
    > .OnAction = "All"
    > .Visible = True
    >
    > End With
    > End Sub
    > --
    > Sharon


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1