not use

M

Mark

I looking for code - if activeworkbook not use for 20
minutes then stuff ..

Please advise I would be very grateful.

Regards
Mark
 
H

Harald Staff

Hi Mark

Use a global Date variable and set it to Now on all sorts of events
(Worksheet_change, Worksheet_Selectionchange, Worksheet_Activate, ... ).
Then have a macro that for certain intervals checks if this variable is more
than 20 minutes old.

HTH. Best wishes Harald
 
H

Harald Staff

I'm not sure I understand this question. But you have to define every single
event that qualifies for your "in use" definition and put some code there.

HTH. Best wishes Harald
 
M

Mark

Hi Harald!
I not very smart in VBA, yet.
I write following code, not work good:

(in body workshhet)

Public dd as Date
Sub Worksheet_Change(ByVal Target As Range)
dd = Now
Application.OnTime dd + TimeValue("00:00:05"), "check"
End Sub

(in body module)
Public dd As Date
Sub check()

a = Now
If a - dd < 5 Then
MsgBox "sheet don't used for 5 sek. "
End If
End Sub

My variable dd isn't global why?
Msgbox still on...
I'd like check not used sheet for e.g 5 sek. and if not
used then show info and next check if not used 5 sek.
Please help!

Regards
Mark
 
Top