Discussion:
using CommandBars OnUpdate event
(too old to reply)
Enrico Pallazo
2005-04-24 11:42:08 UTC
Permalink
Any idea how to determine which CommandBar or
CommandBarButton/Control/etc. fired the OnUpdate event?

Also, I am having a bit of trouble getting the event to fire. I tried
this in a Class (I didn't forget to instantiate the event) and
ThisWorkbook (can't use WithEvents in a Module) but can't get it to
fire.
I had it working in the office (I am now at my home office), but I
can't remember how I got there...

... from ThisWorkbook ...
Public WithEvents CBars As CommandBars
Public CBar As CommandBar

Private Sub CBars_OnUpdate()
Set CBar = CBars(Me.CommandBars.ActiveMenuBar)
MsgBox CBar.Name & "<_>" & CBar.Index, vbOKOnly, "Class1"
End Sub
Jonathan West
2005-04-24 14:10:32 UTC
Permalink
Which version of Word are you using?

I have found that the OnUpdate event works as documented in Word 2000, but
that the event doesn't fire in Word 2003.
--
Regards
Jonathan
Post by Enrico Pallazo
Any idea how to determine which CommandBar or
CommandBarButton/Control/etc. fired the OnUpdate event?
Also, I am having a bit of trouble getting the event to fire. I tried
this in a Class (I didn't forget to instantiate the event) and
ThisWorkbook (can't use WithEvents in a Module) but can't get it to
fire.
I had it working in the office (I am now at my home office), but I
can't remember how I got there...
... from ThisWorkbook ...
Public WithEvents CBars As CommandBars
Public CBar As CommandBar
Private Sub CBars_OnUpdate()
Set CBar = CBars(Me.CommandBars.ActiveMenuBar)
MsgBox CBar.Name & "<_>" & CBar.Index, vbOKOnly, "Class1"
End Sub
Enrico Pallazo
2005-04-26 09:28:14 UTC
Permalink
Actually, Excel XP (2002)
Enrico Pallazo
2005-04-26 09:29:20 UTC
Permalink
ISorry - I just realized this is the Word VBA group - I will move my
post elsewhere.

Loading...