VBA code that closes excel after inactivity and can run with other macros -
hello looking code close excel after specified amount of time user has been inactive. have code online problem not run correctly other macros in workbook. need code can run other macros , close after user inactivity. appreciated!
call macro inactivity counter @ end of each macro. exit inactivity counter macro using global variable passing 0 @ beginning of each macro. sample code keyboard inactivity control:
public br integer public declare sub sleep lib "kernel32" (byval dwmilliseconds long) private declare function getasynckeystate lib "user32" (byval vkey byte) integer sub brea() br = 0 'do stuff here call test end sub sub test() br = 1 dim t integer t = 0 while t < 15 t = t + 1 sleep (1000) = 0 255 ret = getasynckeystate(i) if ret <> 0 t = 0 next application.statusbar = t if br = 0 goto ends doevents wend application.quit ends: end sub
Comments
Post a Comment