VBA to Extract time that user logged onto Windows

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
 
C

Carl Willems

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top