VBA to Extract time that user logged onto Windows

  • Thread starter Thread starter macroapa
  • Start date Start date
M

macroapa

Hi, I know how to get the name of the current user logged onto
Windows, but I'd like to extract the time that the user logged onto to
the windows session.

This must be possible, but try as I might, I just cant find anything
on the net.

Can anyone help?

Thanks
 
Try using:

Private Declare Function GetTickCount Lib "kernel32" () As Long
myTime = GetTickCount

in myTime you'll get the elapsed time since Windows started in
milliseconds. I don't know whether it is when the machine started, or when
the user logged on, can be different when more than one user is using the
machine, you'd have to test that.

grds,
Carl
 
Back
Top