On 2002-09-11 20:54, mutrus wrote:
When a comment is added to a cell it contains the users login by default.
I wish to add comments by using code. How can I assign the users login to a variable
Actually it doesn't add the users login name.
It meely uses the User name from the Options droplist in Excel, which anyone can change.
If you want the login user name then thius may help;
<pre/>
Declare Function WNetGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" ( _
ByVal lpName As String, _
ByVal lpUserName As String, _
lpnLength As Long) As Long
Function GetName() As String
Dim strUserName As String
strUserName = Space(255)
WNetGetUser "", strUserName, 255
GetName = Trim(strUserName)
End Function
</pre>