ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB code still runing (https://www.excelbanter.com/excel-programming/297939-re-vbulletin-code-still-runing.html)

Chip Pearson

VB code still runing
 
Are you using OnTime for your timer? If so, the settings passed
to OnTime are global to the Excel application, and will only 'go
away' when Excel itself is closed. When the timer pops, Excel
will open the workbook containing the macro specified in OnTime
and execute it.

You should write your code such that the OnTime cancels itself
when the workbook in question is closed.


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


"DVallier" wrote in message
...
I have VB code timer that shuts down a workbook after awhile.

But if you close it early while any other workbook is open, the
time (and code) still runs. I know this because the workbook
re-opens when the timer runs out - only to close it.
Has anyone run into this?




Don Vallier

VB code still runing
 
Thanks, Chip
I never thought of OnTime being global.

Chip Pearson

VB code still runing
 
I never thought of OnTime being global.

The fact that it is a method of the Application object is a good
indicator that it is global to Excel and not part of an
individual workbook.


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



"Don Vallier" wrote in
message
...
Thanks, Chip.
I never thought of OnTime being global.





All times are GMT +1. The time now is 03:29 PM.

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