View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
BAC BAC is offline
external usenet poster
 
Posts: 1
Default Using Application Events

Your "event ignoring machines" may need to have the Events
handler activated try adding --- Lines below:
Dim WithEvents App As Application


---Application.EnableEvents = True

Private Sub Workbook_Open()
Set App = Application
End Sub


Private Sub App_SheetActivate(ByVal Sh As Object)
Select Case Sh.Name
'code
End Select


---Application.EnableEvents = False
---ActiveWorkbook.Save

End Sub


BAC


-----Original Message-----
I am trying to use the Application events to check what

sheets are being
activated by the user and then execute code accordingly.

While this seems
to work fine on my PC, when I create an add-in and load

it on another PC it
does not necessarily work (in some cases it does, in

others it doesn't). In
those cases where it does not work the whole event is

ignored. Anybody with
any experience on this?

The code I use is as follows:

'In the ThisWorkbook module
Dim WithEvents App As Application

Private Sub Workbook_Open()
Set App = Application
End Sub

Private Sub App_SheetActivate(ByVal Sh As Object)
Select Case Sh.Name
'code
End Select
End Sub


.