Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Application Level Events

I need a way to have a sub within my xla to run every time any workbook gets
or losses focus. So if a new workbook is opened or closed, or you just switch
back and forth between two workbooks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Application Level Events

You can read more about application events at Chip Pearson's site:
http://www.cpearson.com/excel/AppEvent.aspx

FYI: these events fire when you stay within Excel. If you swap applications,
they don't fire.

Kent Prokopy wrote:

I need a way to have a sub within my xla to run every time any workbook gets
or losses focus. So if a new workbook is opened or closed, or you just switch
back and forth between two workbooks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Application Level Events

You can put this in the ThisWorkbook code module. Substitute your macro name
for myMacro.

Private Sub Workbook_Deactivate()
Call myMacro
End Sub

"Kent Prokopy" wrote:

I need a way to have a sub within my xla to run every time any workbook gets
or losses focus. So if a new workbook is opened or closed, or you just switch
back and forth between two workbooks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Application Level Events

I found this information in one of the other posts just before you replied.
This is just what I needed.

Thank you very much!


"Dave Peterson" wrote:

You can read more about application events at Chip Pearson's site:
http://www.cpearson.com/excel/AppEvent.aspx

FYI: these events fire when you stay within Excel. If you swap applications,
they don't fire.

Kent Prokopy wrote:

I need a way to have a sub within my xla to run every time any workbook gets
or losses focus. So if a new workbook is opened or closed, or you just switch
back and forth between two workbooks.


--

Dave Peterson

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
Application level events - calling from standard module triaz[_4_] Excel Programming 2 February 24th 06 08:24 AM
Application level events John Excel Programming 1 November 25th 05 07:22 PM
Code: Using Excel Application level Events Chris W[_3_] Excel Programming 0 February 27th 05 07:40 PM
Application Level Events Question nickg420[_4_] Excel Programming 3 July 16th 04 05:02 PM
Application level events no longer execute R Avery Excel Programming 1 June 4th 04 01:21 AM


All times are GMT +1. The time now is 08:46 AM.

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

About Us

"It's about Microsoft Excel"