Re: Adding Customised Buttons to a toolbar
- From: GLT <GLT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Feb 2006 20:37:17 -0800
Hi Bob,
I tried your code but when I try to run it it comes up with a run-time error
'5', Invalid Procedure Call or Argument. I am using MS Excel 2002.
Can you advise what might be causing this?
Thanks,
Geoff.
"Bob Phillips" wrote:
Build it dynamically.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Application.CommandBars("Formating")
On Error Resume Next
.Controls("myButton1").Delete
.Controls("myButton2").Delete
.Controls("myButton3").Delete
On Error GoTo 0
End With
End Sub
Private Sub Workbook_Open()
With Application.CommandBars("Formating")
On Error Resume Next
.Controls("myButton1").Delete
.Controls("myButton2").Delete
.Controls("myButton3").Delete
On Error GoTo 0
With .Controls.Add(Type:=msoControlButton, temporary:=True)
.BeginGroup = True
.Caption = "myButton1"
.Style = msoButtonIcon
.FaceId = 29
.OnAction = "myMacro1"
End With
With .Controls.Add(Type:=msoControlButton, temporary:=True)
.Caption = "myButton2"
.Style = msoButtonIcon
.FaceId = 30
.OnAction = "myMacro2"
End With
With .Controls.Add(Type:=msoControlButton, temporary:=True)
.Caption = "myButton3"
.Style = msoButtonIcon
.FaceId = 31
.OnAction = "myMacro3"
End With
End With
End Sub
This is workbook event code.
To input this code, right click on the Excel icon on the work***
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
"GLT" <GLT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5118041E-6D61-483E-A2C5-F6C3E8D22447@xxxxxxxxxxxxxxxx
Hi,the
I have an excel document in which I added three buttons to a toolbar which
are assigned to three different Macro's.
I then email a copy of the work*** to my colleagues and when they open
file, the buttons that I originally created no longer appear where I putthem.
stays
How do I ensure that any customization that I do of an Excel work***
permanently on the work*** when it's emailed to others?
Thanks...
- Follow-Ups:
- Re: Adding Customised Buttons to a toolbar
- From: Norman Jones
- Re: Adding Customised Buttons to a toolbar
- References:
- Re: Adding Customised Buttons to a toolbar
- From: Bob Phillips
- Re: Adding Customised Buttons to a toolbar
- Prev by Date: Re: Protected *** accepting values from List
- Next by Date: Re: EXCEL should let me establish unlimited numbers of columns.
- Previous by thread: Re: Adding Customised Buttons to a toolbar
- Next by thread: Re: Adding Customised Buttons to a toolbar
- Index(es):