Commanbar toolbar - can we customize size?

S

StargateFan

One of the difficulties with the custom floating toolbar I've been
finding happens when one has few icons, i.e., just 1 or 2. The title
bar is as long as the toolbar is, which seems to be determined by the
# of icons in the toolbar. If there are many icons, the toolbar is
fairly long and one has more than ample space in the toolbar for an
adequate title. Also, I found in the archives how to remove the "X"
in the upper right-hand corner so that has freed up some toolbar title
bar space. However, in one case I have a worksheet that has only 1
icon and though the title is just 2 words, the second word gets
chopped off. In these cases, is there a way to make the toolbar a
certain size? I've googled in the archives but haven't had anything
pertinent come up re this.

The alternative would be to have no name, but the coding seems to
require a label in various places so don't see how that would work.
Better to make the toolbar the desired length.

Thank you! :blush:D
 
J

Jim Cone

S,
Add enough blank buttons to the Toolbar to make it sufficiently long.
Set the enabled property of the blanks to False.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"StargateFan" wrote in message
One of the difficulties with the custom floating toolbar I've been
finding happens when one has few icons, i.e., just 1 or 2. The title
bar is as long as the toolbar is, which seems to be determined by the
# of icons in the toolbar. If there are many icons, the toolbar is
fairly long and one has more than ample space in the toolbar for an
adequate title. Also, I found in the archives how to remove the "X"
in the upper right-hand corner so that has freed up some toolbar title
bar space. However, in one case I have a worksheet that has only 1
icon and though the title is just 2 words, the second word gets
chopped off. In these cases, is there a way to make the toolbar a
certain size? I've googled in the archives but haven't had anything
pertinent come up re this.

The alternative would be to have no name, but the coding seems to
require a label in various places so don't see how that would work.
Better to make the toolbar the desired length.

Thank you! :blush:D
 
N

Norman Jones

Hi StargateFan,

Another possibility would be to use the customze menu to change the button
to image and text: the text can be a string of your choice or as many blanks
as you wish. The toolbar will expand to accept the button text.
 
S

StargateFan

S,
Add enough blank buttons to the Toolbar to make it sufficiently long.
Set the enabled property of the blanks to False.

I got to thinking how funny this is as I struggle with this issue -
I'm sure lots of people get blank buttons they don't want, and here I
am needing one! <g>

I googled the archive of this ng, but there wasn't any help re this
that I could find. I kept playing with the code - adding/removing
commands - to see what I could do to achieve a blank one but only have
a partial result.

Here is the code portion for the supposedly <g> blank button and
wondering where I'm going wrong:


' 4. Put in a blank button to increase toolbar size.
Set myButton = .Controls.Add(Type:=msoControlButton, ID:=23)
With myButton
.Caption = ""
.Enabled = False
End With


No matter what I do, I don't get a blank. Sure, nothing happens when
I click on it which is good, but an image of an open folder appears
and it appears now as "greyed out". I imagine that no action occurs
because of the "false" in the enabled and lack of "action" line, but
the image is not blank and there is a tooltip with word "open" whether
or not I keep the caption line above.

I don't know how to fix this so that that "open" doesn't appear when
hovering but re the image, should I just assign a FaceID that has no
graphic, assuming there is even something of this kind? I'm going now
to check my Word doct with FaceIDs to see if there are any blank
buttons but was wondering if that was best approach for the image part
of this problem.

Thank you!
 
D

Doug Glancy

StargateFan,

Remove the "ID := 23" from your code. I'm guessing that's the "File Open"
control. You don't want that. You can also remove the .Caption = "" line.

hth,

Doug
 
J

Jim Cone

S,

Set myButton = .Controls.Add(Type:=msoControlButton)
myButton.Enabled = False

Jim Cone
San Francisco, USA
 
S

StargateFan

StargateFan,

Remove the "ID := 23" from your code. I'm guessing that's the "File Open"
control. You don't want that. You can also remove the .Caption = "" line.

<g> Darn, something that simple. Done. Works great now, thanks!

Yes re the caption. I'd tried first without that and then with the
empty quotations but that "Open" kept persisting. Obviously that
wasn't what was putting that tooltip in there said:

Yes it did, thanks! :blush:D
 
S

StargateFan

S,

Set myButton = .Controls.Add(Type:=msoControlButton)
myButton.Enabled = False

Jim Cone
San Francisco, USA

Perfect, it now works great. The only thing I did was the change the
above slightly to conform to the code in the previous 3 buttons so the
portion of the code for button 4 in a test file actually looks like
this:




' 4. Put in a blank button to increase toolbar size.
Set myButton = .Controls.Add(Type:=msoControlButton)
With myButton
.Enabled = False
End With




Works perfectly! Thank you. :blush:D
 
D

Doug Glancy

I'm glad I could help. Now if you ever need to know how to add an existing
Excel control to a custom toolbar, you'll know how (of if you're like me,
you'll have to Google yourself looking for this conversation) <g>.

Doug
 
S

StargateFan

I'm glad I could help. Now if you ever need to know how to add an existing
Excel control to a custom toolbar, you'll know how (of if you're like me,
you'll have to Google yourself looking for this conversation) <g>.

Yes! I seem to have enough basic XL2K code stuff down that I can
figure out how to usually find what I'm looking for now (most of the
time <g>).

Thanks and Merry Xmas to you and yours and to everyone in this group!
:blush:D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top