display correct toolbar icon on starting excel application program

  • Thread starter Thread starter ilyaskazi
  • Start date Start date
I

ilyaskazi

following is the code which creates toolbar buttons.
I m using office xp 2003. When i start excel program, it doesnt display
correct toolbar icon for which i hv given face-id. But when i move my
mouse over the button, then it changes to the correct one.



Code:
--------------------

Sub CreateBar()
Dim oBar As CommandBar
Dim oKicker As CommandBarControl

RemoveBar 'Prevents duplicate entry

Set oBar = Application.CommandBars.Add(Name:="SKicker", Position:=1, Temporary:=True)
oBar.Visible = True
Set oKicker = oBar.Controls.Add(ID:=1, Before:=1)

With oKicker
.OnAction = "General.Show_SuperKicker"
.FaceId = 9744
.Caption = "SUPERKICKER"
End With

Set oKicker = Nothing
Set oBar = Nothing

End Sub

--------------------


I need to display correct toolbar-icon when excel program is started.
Also some face-id doesnt work with office-2000-- why so?? It gives
debug msg.
 
some faceID's dont exist and will give a blank icon.

the problem you're having with FaceID 9744..
it doesn't exist in xl2000!

Highest faceID's (approx and from memory)
xl97: 4000
xl2k: ????
xlXP: 7000
xl2003: 10500



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ilyaskazi wrote :
 
if it is existing then why it is not showing the correct face-id icon
when excel program is loaded???

It changes to correct one, only if i move my mouse cursor over that
button...

is there any solution or alternate to this issue.
 
read again: 9744 does NOT exist in xl97/xl2K/xlXP.

it raises an error and (depending on errorhandlers) stops
on the line where you assign faceid 9744

in xl2003 your code runs fine and shows the intended icon
without fail... NO need to move a mouse.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ilyaskazi wrote :
 
KeepITcool,

Please reread the OPs post.
He *is* using XL2003 and he *has* the problem he describes.
No face until the mouse is over the icon/button.

Henry
 
Henry..pls read the *last paragraph* in original post.

As stated I cannot replicate his problem in xl2003.
But he indicates he IS coding for older versions.

So it must be something else...
maybe incorrect referencing of Office Library?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Henry wrote :
 
I hv lot of toolbar items and want to group some of them.

how is it possible through programatically??
 
a rough example:..

assumes commandbar "mybar" has been created

with application.commandbars("mybar")
'create a popup (submenu)
with .controls.add(Type:=msoControlPopup,temporary:=true)
.Caption = "Menu A"
for i=1 to 10
.controls.add(Type:=msoControlButton,temporary:=true)
.caption = "Button " & i
next
end with
end with


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ilyaskazi wrote :
 
there is something expected=

for i=1 to 10
..controls.add(Type:=msoControlButton,temporary:=true)
..caption = "Button " & i
next

i m receiving compile error msg.

help me with editing my above given original code and post here plz.
 
yep. typo. mea culpa:

For i = 1 To 10
With .Controls.Add(Type:=msoControlButton, temporary:=True)
.Caption = "Button " & i
End With
Next




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ilyaskazi wrote :
 
Back
Top