By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

insert username

P: 13
the (NOW) command inserts the system time. Is there a way to insert the user name of the person logged on to a xp machine?
Dec 28 '07 #1
Share this Question
Share on Google+
1 Reply


debasisdas
Expert 5K+
P: 8,127
try to use this

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  2.  
  3. Public Function localUserName() As String
  4. Dim m_myBuf As String * 25
  5. Dim m_Val As Long, UserName As String
  6.  
  7. m_Val = GetUserName(m_myBuf, 25)
  8. localUserName = Left(m_myBuf, InStr(m_myBuf, Chr(0)) - 1)
  9. End Function
  10.  
  11.  
Dec 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.