Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Track Changes Username with Windows

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Track Changes Username with Windows

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
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
Change Tracking by Windows Username Luke Slotwinski Excel Discussion (Misc queries) 3 December 11th 06 03:02 PM
Show Username Param Excel Discussion (Misc queries) 1 March 11th 06 04:09 PM
Username Log PaulJ Excel Discussion (Misc queries) 8 March 1st 06 12:51 PM
Saving username into a cell thudson Excel Worksheet Functions 1 February 24th 06 11:10 PM
NT Username ceemo Excel Discussion (Misc queries) 4 August 2nd 05 04:39 PM


All times are GMT +1. The time now is 04:35 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"