Link to home
Start Free TrialLog in
Avatar of David Phelops
David PhelopsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Determine How Long Since Last Boot

There is always someone in the office who will notever refresh, reboot, switch off, or restart his / her pc.

Is there a method to determine, from within excel vba, how long windows has been running?

Thereby enabling a message box to be displayed recommending that the user reboot his machine if it has been running for a long time?

Thanks you very much
David
ASKER CERTIFIED SOLUTION
Avatar of [ fanpages ]
[ fanpages ]

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Phelops

ASKER

Thanks very much fanpages - really specific and helpful information - exactly what I needed.
This is how I have used it:

VB userform attached for your pleasure!

Run as follows:
Sub Uptime()

'This routine displays a userform, if his/her PC has been running for 4 days, to recommend that it is re-booted.
'Note: GetTickCount system function shown in milliseconds

If GetTickCount > 691200000 Then uf_Uptime.Show

End Sub

Open in new window

uf-Uptime.frm
Very helpful, clear and specific answer.
most appreciated.
Cheers
David
Avatar of [ fanpages ]
[ fanpages ]

You're very welcome.

Thanks for the attachment.

Good luck with convincing your users to not ignore the message!

Talking of which, this (currently active) question thread may interest you (just for thoughts on enhancing your approach):

[ https://www.experts-exchange.com/questions/28263135/code-to-make-sure-Excel-file-is-closed-after-a-certain-length-of-time.html ]
oh, yes, thanks - that is useful to know too, (Evil and Dilbertian) :-)