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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

615 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