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
363 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
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
akoster 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:akoster
akoster 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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 a scrolling table in Microsoft Excel using the INDEX function.

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now