Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am not familiar with Visual Basic and have a basic knowledge of Macros.
I am using a shared workbook with multiple users on one computer as well as single users on other computers. Is there a way to track changes with the users Window log on ID as the username in Excel? The company name appears in the General tab username when each user logs in as it was entered when the program was installed. It is impractical to log each user on and changing the username in Excel after they have logged in. I am aware there was another post refering to this but it did not work for me. This may be a result of my inexperience with VB. Your help, as always is greatly appreciated. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't think you can change that behavior.
But you could send out an excel file that updates that Username based on their login name. Option Explicit Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Declare Function apiGetComputerName Lib "kernel32" Alias _ "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If lngX < 0 Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = "" End If End Function Sub auto_Open() Dim myWindowsName As String Dim myExcelName As String myWindowsName = fOSUserName myExcelName = Application.UserName If LCase(myExcelName) = LCase("Yourcompanynamehere") Then 'change the name Application.UserName = myWindowsName End If End Sub If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm This will only change the username if the existing tools|Options|General tab username matches what you type in this spot: Yourcompanynamehere Otherwise, it leaves the user name alone. Trying to Excel wrote: I am not familiar with Visual Basic and have a basic knowledge of Macros. I am using a shared workbook with multiple users on one computer as well as single users on other computers. Is there a way to track changes with the users Window log on ID as the username in Excel? The company name appears in the General tab username when each user logs in as it was entered when the program was installed. It is impractical to log each user on and changing the username in Excel after they have logged in. I am aware there was another post refering to this but it did not work for me. This may be a result of my inexperience with VB. Your help, as always is greatly appreciated. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change Tracking by Windows Username | Excel Discussion (Misc queries) | |||
Show Username | Excel Discussion (Misc queries) | |||
Username Log | Excel Discussion (Misc queries) | |||
Saving username into a cell | Excel Worksheet Functions | |||
NT Username | Excel Discussion (Misc queries) |