![]() |
Note Code Help
I have the following code:
On Error Resume Next Dim curComment As String curComment = "" curComment = Target.Comment.Text If curComment < "" Then curComment = curComment & Chr(10) Target.AddComment Target.Comment.Text Text:=curComment & _ ActiveWorkbook.BuiltinDocumentProperties("Author") & _ ": Rev. " & Format(Date, "mm-dd-yyyy") & ", From (" & Worksheets("Password").Range("A16").Value & ")" I have two problems: 1) I want it to put in the note the person who is logged in, not the ("Author"). 2) I want this note to be visibale. |
Note Code Help
From: Trevor Shuttleworth )
Subject: Code to show login name Newsgroups: microsoft.public.excel.programming Date: 2001-01-16 12:54:01 PST Private Declare Function apiGetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long Sub GetUserNameTest() MsgBox fOSUserName End Sub 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 ------------------- Mr. Erlandsend's site: http://www.erlandsendata.no/english/vba/os/index.htm has code for username and computer name. Regards, Tom Ogilvy scrabtree23 wrote in message ... I have the following code: On Error Resume Next Dim curComment As String curComment = "" curComment = Target.Comment.Text If curComment < "" Then curComment = curComment & Chr(10) Target.AddComment Target.Comment.Text Text:=curComment & _ ActiveWorkbook.BuiltinDocumentProperties("Author") & _ ": Rev. " & Format(Date, "mm-dd-yyyy") & ", From (" & Worksheets("Password").Range("A16").Value & ")" I have two problems: 1) I want it to put in the note the person who is logged in, not the ("Author"). 2) I want this note to be visibale. |
All times are GMT +1. The time now is 09:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com