PDA

View Full Version : Solved: Toolbar Menu Icon- Caption problem



ukdane
11-07-2008, 02:55 AM
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

Bob Phillips
11-07-2008, 02:57 AM
Set the Style property of the button



.Style = msoButtonCaption

ukdane
11-07-2008, 03:03 AM
Wow, that was quick, and it works :-)
Thanks!

ukdane
11-07-2008, 03:06 AM
As a side question, If I want to create some dead space between 2 menu icons, how do I do that?
Cheers

ukdane
11-07-2008, 03:08 AM
... or a dividing bar between two icons, for that matter.

GTO
11-07-2008, 04:24 AM
Greetings ukdane,

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

.BeginGroup = True

Hope this helps,

Mark


bis peccare in bello non licet