GreenyMcDuff
Active Member
- Joined
- Sep 20, 2010
- Messages
- 313
Hi all,
I usually use excel 2007, when I create a macro I usually assign it a button on the add-ins tab on the ribbon.
However, I have created a macro for use in 2003 only. I want to assign a custom button to the macro and tried using the same code:
I assume this isn't compatible with excel 2003, does anyone know how to make it so?
Thanks
Chris
I usually use excel 2007, when I create a macro I usually assign it a button on the add-ins tab on the ribbon.
However, I have created a macro for use in 2003 only. I want to assign a custom button to the macro and tried using the same code:
Code:
Sub auto_open()
On Error Resume Next
Application.CommandBars("Security Type Identifier").Delete
Set mybar = CommandBars _
.Add(Name:="Security Type Identifier", Position:=msoBarTop, _
Temporary:=True)
mybar.Visible = True
Set newbutton = mybar.Controls _
.Add(Type:=msoControlButton)
With newbutton
.Style = msoButtonCaption
.Caption = "Run Security Type Identifier"
.OnAction = "Data"
End With
End Sub
Sub auto_close()
On Error Resume Next
Application.CommandBars("Security Type Identifier").Delete
End Sub
I assume this isn't compatible with excel 2003, does anyone know how to make it so?
Thanks
Chris