Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Getting a hook on Toolbar Events

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Getting a hook on Toolbar Events

bVisible = commandbars("My Command Bar").visible

HTH
--
AP

"WhytheQ" a écrit dans le message de news:
...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Getting a hook on Toolbar Events

There is no event that fires when the visible property of a command bar is
changed so I am affraid you are out of luck on this one.
--
HTH...

Jim Thomlinson


"WhytheQ" wrote:

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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Getting a hook on Toolbar Events


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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I "re-hook" my worksheet window to my Excel window? Jal Excel Discussion (Misc queries) 1 August 29th 08 10:11 PM
How can I "re-hook" my worksheet window to my Excel window? Jal Excel Discussion (Misc queries) 0 August 29th 08 09:38 PM
do events? background events cereldine[_15_] Excel Programming 1 April 12th 06 01:06 PM
Adjusting toolbar size, restore toolbar Josh M Excel Discussion (Misc queries) 1 January 18th 06 06:17 PM
hook into worksheet events temporarily? Alex Popescu Excel Programming 1 December 15th 05 01:25 PM


All times are GMT +1. The time now is 12:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"