Posted to microsoft.public.excel.programming
|
|
Getting a hook on Toolbar Events
as per usual where others give up, KeepItCool comes up with the goods:
Thanks!
J
keepITcool wrote:
You dont need events or hooks.
Simply use protection for your bar (see VBA help for details):
Sub ObstinateBar()
On Error Resume Next
CommandBars("Test").Delete
On Error GoTo 0
With CommandBars.Add("Test", msoBarFloating, , True)
With .Controls.Add(msoControlButton, , , , True)
.Caption = "Button"
.FaceId = 59
.OnAction = " BtnHandler"
End With
.Visible = True
.Protection = msoBarNoChangeDock + _
msoBarNoChangeVisible + _
msoBarNoCustomize
End With
'OfficeXP has a few more options
'Following code will compile and work in versions 97-2003
#If VBA6 Then
If Val(Application.Version) 10 Then
CallByName CommandBars, "DisableAskAQuestionDropdown", VbLet, True
CallByName CommandBars, "DisableCustomize", VbLet, True
End If
#End If
End Sub
--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam
WhytheQ wrote in
groups.com
How could I trap toolbar events: I'd like a boolean variable to change
when a custom toolbar has been made invisible i.e it is a floating
custom toolbar and I'd like a boolean variable to change when the user
hits the cross to make the bar invisible.
Is a class module the only answer?
Regards
Jason.
|