Hello everyone
I need to know the time elapsed since the windows started ..
Thanks advanced
Hello everyone
I need to know the time elapsed since the windows started ..
Thanks advanced
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
As an Excel question, do you mean since the Excel macro started? Or are you trying to figure out when the PC was last booted?
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Thanks sir for reply
I'm trying to figure out when the PC last booted?
Maybe :
Private Declare Function GetTickCount Lib "kernel32" () As Long Sub Test() MsgBox Format(GetTickCount() / 86400000, "HH:MM:SS") End Sub
A quick Google search seems to imply adding this function to your workbook:
Then add this function I wrote as well, this can be used from a cell formatted as date/time: m/d/yyyy h:mmPrivate Declare PtrSafe Function GetTickCount Lib "kernel32.dll" () As Long
In a cell as =LastBootTime()Public Function LastBootTime() As Date LastBootTime = Now - (GetTickCount / 1000 / 86400) End Function
Mr. Karedog
That's perfect solution. Thanks a lot for sharing it
Mr. JBeaucaire
Thank you very much but I got incorrect results
I tried this and it is ok
#If VBA7 Then Private Declare PtrSafe Function GetTickCount Lib "kernel32.dll" () As Long #Else Private Declare Function GetTickCount Lib "kernel32.dll" () As Long #End If Public Function LastBootTime() As Date LastBootTime = GetTickCount / 1000 / 86400 End Function
Last edited by YasserKhalil; 10-08-2015 at 02:47 PM.
My apologies, yes, your version gives time elapsed, mine gives the exact date/time of the last boot.
Never mind .. no need for apologies at all.. You are awesome ..
Thanks a lot for this great help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks