Update fields?
Hi,
I wrote a function to get the current user's name: ' Get current user's name Public Function GetUser() As String GetUser = Environ("UserName") End Function It works fine on my computer, but other users say they had to double-click on the fields to make its content being updated. How can this be done within a macro? Thanks, Cannabibal |
Update fields?
Have you tried:
GetUser=Application.Username "Cannabibal" wrote: Hi, I wrote a function to get the current user's name: ' Get current user's name Public Function GetUser() As String GetUser = Environ("UserName") End Function It works fine on my computer, but other users say they had to double-click on the fields to make its content being updated. How can this be done within a macro? Thanks, Cannabibal |
Update fields?
Here iks an API way ro get the login name
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 The worksheet cell could then use =UserName() -- HTH RP (remove nothere from the email address if mailing direct) "gocush" wrote in message ... Have you tried: GetUser=Application.Username "Cannabibal" wrote: Hi, I wrote a function to get the current user's name: ' Get current user's name Public Function GetUser() As String GetUser = Environ("UserName") End Function It works fine on my computer, but other users say they had to double-click on the fields to make its content being updated. How can this be done within a macro? Thanks, Cannabibal |
All times are GMT +1. The time now is 07:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com