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
362 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

759 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

18 Experts available now in Live!

Get 1:1 Help Now