Consulting

Results 1 to 6 of 6

Thread: Solved: Toolbar Menu Icon- Caption problem

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Solved: Toolbar Menu Icon- Caption problem

    Hi, New to the forum, looking for help.

    I've been having trouble with my toolbar in Excel 2000.
    I've created my own toolbar using vba, without too much problem.
    However I've come across two problems.

    1. I've created a menu bar full of icons, which is great. I even have the ToolTipText working. BUT there are one or two of the buttons, where I need to replace the icon with some text instead. I've tried removing the FaceId, and using the Caption, as seen in the example below:
    Set myCommandBarCtl = myBar.Controls.Add(Type:=msoControlButton)
    With myCommandBarCtl
    .Caption = "Hent"
    '.FaceId = 1000
    .TooltipText = "Hent data"
    .OnAction = "getmydata"
    End With
    The button is visible, BUT empty. How can I get it to show the caption text?

    2. My second problem is a little along the same vein.
    This time, I've inserted a PopupControl, to the left of the Edit button on the menu bar.
    No problem.
    However, I also need to put a button there, so it doesn't popup/dropdown, but actions straight away. I simply replaced the Type:=msoControlPopup with Type:=msoControlButton. And the button works. BUT I then find myself in the same situation as with problem 1, I can only use an icon, and not text to represent the button. So, again, how do I get it to show the button name, instead of the icon picture?

    I hope I've explained my problem clearly enough.
    Thanks in advance for any help.
    Cheers

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Set the Style property of the button

    [vba]

    .Style = msoButtonCaption
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Wow, that was quick, and it works :-)
    Thanks!

  4. #4
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    As a side question, If I want to create some dead space between 2 menu icons, how do I do that?
    Cheers

  5. #5
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    ... or a dividing bar between two icons, for that matter.

  6. #6
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Greetings ukdane,

    To put a 'divider line' between two controls, use...

    [vba] .BeginGroup = True[/vba]

    Hope this helps,

    Mark

    bis peccare in bello non licet

Posting Permissions

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