Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm trying to retrieve windows user name or log in name on a excel sheet with
certain commands. But i'm not sure if excel supports this feature. Currently i'm using MS Office 2003 and WindowsXP professional edition. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
From the internet (www.mrexcel.com) :
Option Explicit ' This is used by GetUserName() to find the current user's ' name from the API Declare Function Get_User_Name Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, _ nSize As Long) As Long Function GetUserName() As String Dim lpBuff As String * 25 Get_User_Name lpBuff, 25 GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1) End Function Sub test() [A1] = GetUserName End Sub Daniel I'm trying to retrieve windows user name or log in name on a excel sheet with certain commands. But i'm not sure if excel supports this feature. Currently i'm using MS Office 2003 and WindowsXP professional edition. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
As clarification, Daniel's code needs to go in the VBA editor. Right click
the sheet tab, select view code, and then paste the code in. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Sirigeri Goutam Shetty" wrote: I'm trying to retrieve windows user name or log in name on a excel sheet with certain commands. But i'm not sure if excel supports this feature. Currently i'm using MS Office 2003 and WindowsXP professional edition. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just to clarify a little further, it doesn't all go there. This bit has to go
in a module in 'This Workbook' Declare Function Get_User_Name Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, _ nSize As Long) As Long Id go for something simpler. Range("A1").Value = Environ("Username") Mike "Luke M" wrote: As clarification, Daniel's code needs to go in the VBA editor. Right click the sheet tab, select view code, and then paste the code in. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Sirigeri Goutam Shetty" wrote: I'm trying to retrieve windows user name or log in name on a excel sheet with certain commands. But i'm not sure if excel supports this feature. Currently i'm using MS Office 2003 and WindowsXP professional edition. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You can't do it directly from a formula -- you need VBA code. User
Function UserName() As String UserName = Environ("UserName") End Function Then, call that function from a worksheet cell: =UserName() Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 12 Nov 2008 05:00:02 -0800, Sirigeri Goutam Shetty <Sirigeri Goutam wrote: I'm trying to retrieve windows user name or log in name on a excel sheet with certain commands. But i'm not sure if excel supports this feature. Currently i'm using MS Office 2003 and WindowsXP professional edition. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
to retrieve a particular value from excel sheet | New Users to Excel | |||
Retrieve Data from one sheet to another | Excel Worksheet Functions | |||
How do I import Names of Windows files into an Excel Spread sheet | Excel Worksheet Functions | |||
Windows XP Excell - sheet 1 / shhet 2 / sheet 3... | Excel Discussion (Misc queries) | |||
Function that gives Windows current user name? | Excel Worksheet Functions |