oh, and another thing

  • Thread starter Thread starter ted daniels
  • Start date Start date
T

ted daniels

in addition to my previous entry and completely un-
related, Is there anyway to return a string for
whichever user is logged on? We use Xp and log in in the
usual way and it would be useful to have something like

dim currentuser as string

if currentuser = "ARoberts" then
usefform21.show
blah blah blah
end if
 
Hi Ted,

Here's a simple little function to get it

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top