For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm
Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)
And if you use xl2007:
If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm
In xl2007, those toolbars and menu modifications will show up under the addins.
===========
Here's a modified version of the toolbar code from Debra Dalgleish's site.
You'll have to add a worksheet with the pictures on it. (Hide that worksheet
later???)
Option Explicit
Public Const ToolBarName As String = "MyToolbarName"
Sub Auto_Open()
Call CreateMenubar
End Sub
Sub Auto_Close()
Call RemoveMenubar
End Sub
Sub RemoveMenubar()
On Error Resume Next
Application.CommandBars(ToolBarName).Delete
On Error GoTo 0
End Sub
Sub CreateMenubar()
Dim iCtr As Long
Dim MacNames As Variant
Dim CapNames As Variant
Dim TipText As Variant
Dim PictNames As Variant
Dim PictWks As Worksheet
Call RemoveMenubar
MacNames = Array("aaa", _
"bbb")
CapNames = Array("AAA Caption", _
"BBB Caption")
TipText = Array("AAA tip", _
"BBB tip")
PictNames = Array("Pic1", "Pic2")
Set PictWks = ThisWorkbook.Worksheets("Pictures")
With Application.CommandBars.Add
.Name = ToolBarName
.Left = 200
.Top = 200
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
For iCtr = LBound(MacNames) To UBound(MacNames)
PictWks.Pictures(PictNames(iCtr)).Copy
With .Controls.Add(Type:=msoControlButton)
.OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr)
.Caption = CapNames(iCtr)
.Style = msoButtonIconAndCaption
.PasteFace
.TooltipText = tip_text(iCtr)
End With
Next iCtr
End With
End Sub
Sub AAA()
MsgBox "aaa"
End Sub
Sub BBB()
MsgBox "bbb"
End Sub
(E-Mail Removed) wrote:
>
> On May 5, 9:40 am, igivan...@gmail.com wrote:
> > What I want:
>
> [...]
>
> Note: I have no problem with creating/deleting a toolbar and buttons
> and attaching macros programmatically on the fly. So this would solve
> most of the problem, but there seems to be no way to put custom images
> on buttons.
>
> ---
> Igor
--
Dave Peterson