Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default oh, and another thing

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default oh, and another thing

Hi
try

msgbox Environ("UserName")

-----Original Message-----
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


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default oh, and another thing

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)

"ted daniels" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
not sure if i'm using the right thing Tiffany Excel Worksheet Functions 4 September 19th 08 05:21 PM
Oh, just one more thing Mike[_12_] Excel Discussion (Misc queries) 1 July 27th 08 04:32 AM
One Last Thing Coltsfan Excel Discussion (Misc queries) 1 January 16th 06 08:42 PM
one more thing Bompi Excel Worksheet Functions 1 January 11th 05 08:09 PM
New to this thing BowD Excel Programming 2 December 19th 03 03:29 AM


All times are GMT +1. The time now is 10:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"