View Single Post
  #2   Report Post  
dominicb
 
Posts: n/a
Default


Good morning moglione1

What you're asking here is actually pretty advanced stuff. The only
way I can think of doing this is by creating a toolbar "on the fly"
using VBA code and show using event procedures (Workbook_Open) and
delete it before the file is closed using the Workbook_Close
procedure.

The code to create a bar with one button is as follows:

Sub MyTB()
On Error Resume Next
Application.CommandBars("My Toolbar").Delete
Set TB = Application.CommandBars.Add(Name:="My Toolbar")
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 263
.OnAction = Macro1
End With
Application.CommandBars("My Toolbar").Visible = True
End Sub

When clicked the button will run Macro1. The image on the button is
no. 263 (use the utility from the link below to see them all).

http://www.oaltd.co.uk/DLCount/DLCou...e=BtnFaces.zip

To delete your toolbar use this code:

Sub KillToolbar()
Application.CommandBars("My Toolbar").Delete
End Sub

That bit's nice and easy...!

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=469808