Solved

When inserting comment in Excel 2007 on Terminal Server the user is always the same no matter who is logged in

Posted on 2011-03-03
3
371 Views
Last Modified: 2012-05-11
Hi,

We have a Terminal Server running Office 2007 and some other finance related programs. Because it is finance they use Excel heavily, but the only problem is that when they insert a comment the user listed in the comment (ie.. "username:") is the same user no matter which users is logged in. The username listed happens to be the user name entered when the server  was first built.

Is there any way we can change things so that excel starts a comment off with the currently logged in user (Profile based), so that they can track who is making changes to the spreadsheets.

I hope that makes sense, but if not go into Excel right mouse click on a cell and click Insert Comment. You will then see the comment box appear and the username followed by a colon. it is the username that needs to be the same as the logged in user. Office 2007 has recently been installed and this didn't happen with 2003.

Software:
Windows 2003 Server SP 1
Microsoft Office Standard 2007
0
Comment
Question by:biggles70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Arno Koster earned 500 total points
ID: 35034883
You can change the default comment name by the code
application.username = "yeddie yeddie"

Open in new window


To find out who is the active user, you could try out a number of options :

 - windows login name
Debug.Print Environ("USERNAME")

Open in new window


- activedirectory user name
Dim objAdSys, objUser
Set objAdSys = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objAdSys.UserName)
Debug.Print objUser.get("cn")
Debug.Print objUser.get("displayname")

Open in new window


- use windows API
first declare getusername function in the upper section of a vba module
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Open in new window

below that, add following code in a subroutine
Dim strLen As Long
Dim strtmp As String * 256
Dim strUserName As String
strLen = 255
GetUserName strtmp, strLen
strUserName = Trim$(Replace(strtmp, Chr$(0), ""))
Debug.Print strUserName

Open in new window


pick one that suits your need and replace the "debug.print" for "application.username ="
0
 
LVL 19

Assisted Solution

by:Arno Koster
Arno Koster earned 500 total points
ID: 35034925
for an extensive overview of other possibilities in working with comments, you might want to have a look at

http://www.contextures.com/xlcomments03.html
0
 

Author Closing Comment

by:biggles70
ID: 35076534
Both responses were, or will be, good to know in time.

Unfortunately time was short and I advised users to do the following:

click on the Office button -> Excel options and change the name under popular - Personalize your copy of Microsoft Office.

Even when we removed the users profile, or got a new user to login, they were getting the name used from when the server was built. Users changed their name as above and it remains after they logout and back in.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Take Space out of Email 11 41
vba code to create folders according to a hyperlink 14 41
Excel VBA Script 9 55
Unique List in UserForm 3 23
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question