View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BigOil BigOil is offline
external usenet poster
 
Posts: 1
Default Customizing the toolbar Icon

I am creating a custom Add-in that creates a toolbar on the users
excel. However, I want to create a custom icon by right-clicking on
the toolbar and then editing the image. When I do this however, the
next time I open excel, the customized image I created is lost. How
can I get it to save my cusome Image? Here is the code I used to
create the toolbar:


Sub CreateNewCommandBar()

Dim lcb_Bar As CommandBar

'' Delete any pre-existing CommandBar that uses our name
DeleteCommandbar gStr_CbarName

'' Set a reference to the CommandBar we create
Set lcb_Bar = CommandBars.Add(Name:=gStr_CbarName,
Position:=msoBarTop, Temporary:=True)

'' Create the controls

''Add AFE button
Dim AFE_button As CommandBarButton
Set AFE_button = lcb_Bar.Controls.Add(Type:=msoControlButton)
With AFE_button
.Style = msoButtonIconAndCaption
.Caption = "Get AFE Data"
.OnAction = "Get_AFE"
End With
''Add CC button
Dim CC_button As CommandBarButton
Set CC_button = lcb_Bar.Controls.Add(Type:=msoControlButton)
With CC_button
.Style = msoButtonIconAndCaption
.Caption = "Get CC Data"
.OnAction = "Get_CC"
End With

'' Ensure it is visible
lcb_Bar.Visible = True


End Sub

Function DeleteCommandbar(pStr_CbName As String) As Boolean
Dim x
Dim lBoo_tf As Boolean

lBoo_tf = False

For Each x In Application.CommandBars
If pStr_CbName = x.Name Then
x.Delete
lBoo_tf = True
End If
Next

End Function