M
MichaelA
Hello All,
I have been using Rod Gill's book to implement a toolbar with a button
that executes a particular module. The toolbar installs, no problem.
However, it doesn't matter how I write the VBA, the command button
just does not execute or even give an error.
The following is the code in "ThisProject" under the global.mpt
I would be grateful for any pointers on what is wrong here.
thanks
Michael Andersen
Dim MyBar As CommandBar
Dim MyButton As CommandBarButton
On Error Resume Next
Set MyBar = CommandBars("Macros")
If MyBar Is Nothing Then
Set MyBar = CommandBars.Add(Name:="Macros",
Position:=msoBarFloating, temporary:=True)
End If
Set MyButton = Nothing
Set MyButton = MyBar.Controls("Excel Export")
If MyButton Is Nothing Then
Set MyButton = MyBar.Controls.Add(Type:=msoControlButton)
With MyButton
.Style = msoButtonCaption
.Caption = "Excel Export"
.OnAction = "MacroNameHere"
End With
End If
MyBar.Visible = True
I have been using Rod Gill's book to implement a toolbar with a button
that executes a particular module. The toolbar installs, no problem.
However, it doesn't matter how I write the VBA, the command button
just does not execute or even give an error.
The following is the code in "ThisProject" under the global.mpt
I would be grateful for any pointers on what is wrong here.
thanks
Michael Andersen
Dim MyBar As CommandBar
Dim MyButton As CommandBarButton
On Error Resume Next
Set MyBar = CommandBars("Macros")
If MyBar Is Nothing Then
Set MyBar = CommandBars.Add(Name:="Macros",
Position:=msoBarFloating, temporary:=True)
End If
Set MyButton = Nothing
Set MyButton = MyBar.Controls("Excel Export")
If MyButton Is Nothing Then
Set MyButton = MyBar.Controls.Add(Type:=msoControlButton)
With MyButton
.Style = msoButtonCaption
.Caption = "Excel Export"
.OnAction = "MacroNameHere"
End With
End If
MyBar.Visible = True