ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code: Using Excel Application level Events (https://www.excelbanter.com/excel-programming/324173-re-code-using-excel-application-level-events.html)

Chris W[_3_]

Code: Using Excel Application level Events
 
This is the code im my class module called:
EventClassModule

Public WithEvents App As Application

Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
Dim cnt As Integer, X As Integer
If ActiveWorkbook Is Nothing Then
cnt = Application.CommandBars("Worksheet Menu
Bar").Controls.Count
For X = 1 To cnt
If Application.CommandBars("Worksheet Menu
Bar").Controls(X).Caption = "&Rolodex Tools" Or _
Application.CommandBars("Worksheet Menu
Bar").Controls(X).Caption = "&Rolodex Tools*" Then
Application.CommandBars("Worksheet Menu
Bar").Controls(X).Enabled = False
Exit Sub
End If
Next X
End If
End Sub
--------------------------------------------------------

This is the subroutine placed in a standard module (this
is called from the ThisWorkbook Workbook_Open() event of
Personal.XLS.

Dim EvntCl As New EventClassModule

Sub InitializeApp()
Set EvntCl.App = Application
End Sub
----------------------------------------------------------

-----Original Message-----
It would be useful if you posted the code you are using.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Chris w." wrote in

message
...
Excel level Event not firing. I followed the directions
given in Excel Help to initialize the App level events.
But the event is not firing. I created a class object

for
the Application object. I put an initialize subroutine
code in a workbook level module, and I call it in the
openworkbok event. All of these are in Personal.xls.

Can
someone give me assistance. Is there a scope problem?
Please help.



.



All times are GMT +1. The time now is 01:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com