J
Jan Grinwis
I have a worksheet with a username function in it. The cell with the
function call =fOSUserName() will not update if another user is using
the worksheet. If I manualy edit and enter the cell again it works
great.
If I calculate the sheet at start with the auto_open macro it makes no
difference, it wil keep the last saved name.
What could be wrong??
In the future I want to use this function in a shared file is....Also
a problem??
The Function looks and macro looks like: (by the way this comes from
this great group....)
Private Declare Function apiGetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (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 GetUserNameTest()
MsgBox fOSUserName
End Sub
Sub auto_open()
Worksheets("blad1").Calculate
End Sub
Jan.....
function call =fOSUserName() will not update if another user is using
the worksheet. If I manualy edit and enter the cell again it works
great.
If I calculate the sheet at start with the auto_open macro it makes no
difference, it wil keep the last saved name.
What could be wrong??
In the future I want to use this function in a shared file is....Also
a problem??
The Function looks and macro looks like: (by the way this comes from
this great group....)
Private Declare Function apiGetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (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 GetUserNameTest()
MsgBox fOSUserName
End Sub
Sub auto_open()
Worksheets("blad1").Calculate
End Sub
Jan.....