screamager
Technical User
Hi,
I'm trying to create an add-in for Excel 2000 with VBA, but can't seem to get past even the first obstacle.
I add this to the workbook code:
Private Sub Workbook_AddinInstall()
Dim asdf As CommandBar
Dim qwer As CommandBarButton
Set asdf = Application.CommandBars("File"
Set qwer = asdf.Controls.Add(Type:=msoControlButton)
qwer.Caption = "TEST"
qwer.OnAction = "DoItNow"
End Sub
Sub DoItNow()
MsgBox "YEAH!"
End Sub
Private Sub Workbook_AddinUninstall()
Dim asdf As CommandBar
Dim qwer As CommandBarButton
Set asdf = Application.CommandBars("File"
For x = asdf.Controls.Count To 1 Step -1
If asdf.Controls(x).Caption = "TEST" Then
asdf.Controls(x).Delete
End If
Next
End Sub
..and then I save the work book as an add-in (.xla file). All I get when i press the 'TEST' menu item is an error telling me 'The Macro test.xla!DoItNow cannot be found' or something to that effect. Am i missing something really obvious or what?
I'm trying to create an add-in for Excel 2000 with VBA, but can't seem to get past even the first obstacle.
I add this to the workbook code:
Private Sub Workbook_AddinInstall()
Dim asdf As CommandBar
Dim qwer As CommandBarButton
Set asdf = Application.CommandBars("File"
Set qwer = asdf.Controls.Add(Type:=msoControlButton)
qwer.Caption = "TEST"
qwer.OnAction = "DoItNow"
End Sub
Sub DoItNow()
MsgBox "YEAH!"
End Sub
Private Sub Workbook_AddinUninstall()
Dim asdf As CommandBar
Dim qwer As CommandBarButton
Set asdf = Application.CommandBars("File"
For x = asdf.Controls.Count To 1 Step -1
If asdf.Controls(x).Caption = "TEST" Then
asdf.Controls(x).Delete
End If
Next
End Sub
..and then I save the work book as an add-in (.xla file). All I get when i press the 'TEST' menu item is an error telling me 'The Macro test.xla!DoItNow cannot be found' or something to that effect. Am i missing something really obvious or what?