Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I forgot my usual bit about visiting John Walkenbach's webpage site at
http://j-walk.com/ss/excel/tips/tip67.htm to help find the values of the FaceIds, which will give you a decent toolbar button image. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... Andy, Here's some code to create a toolbar on workbook open, and delete it on close. Private Sub Workbook_Open() Dim oCb As CommandBar Dim oCtl As CommandBarPopup Dim oCtlBtn As CommandBarButton On Error Resume Next Application.CommandBars("Custom Toolbar").Delete ' just in case On Error GoTo 0 Set oCb = Application.CommandBars.Add(Name:="Custom Toolbar") With oCb Set oCtlBtn = .Controls.Add(Type:=msoControlButton, temporary:=True) oCtlBtn.Caption = "myMacroButton" oCtlBtn.FaceId = 161 oCtlBtn.OnAction = "myMacro" .Visible = True End With End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim oCb As CommandBar Set oCb = Application.CommandBars("Custom Toolbar") oCb.Controls("myMacroButton").Delete End Sub Put the code in the ThisWorkbook code module -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Andy" wrote in message ... Hi All I have written a macro function that works well for me. I now want to set up a custom button and associate it to the function such that I can distribute an add in with the customised button mapped to that function. Is that possible? TIA Andy |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom macro and custom button | New Users to Excel | |||
2003 - 2007 custom macro and custom button restore. | Excel Discussion (Misc queries) | |||
Macro/Custom Button | Excel Discussion (Misc queries) | |||
Macro and custom Button | Excel Discussion (Misc queries) | |||
Send a custom button/macro to others? | Excel Discussion (Misc queries) |