Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Name of user from Office (or like)

Status
Not open for further replies.

baltman

Technical User
Mar 5, 2002
1,578
US
My workplace uses employee # for login, but I'd like to be able to put a real name into a report on the fly.

I know Office 'knows' the user's full name (i.e. Outlook, or under 'Author' in Office doc's properties), does anyone know how I'd get it out of there efficiently?

Thanks,
Brian
 
I've figured this out using Excel, but mayber there's a way to get the value without creating/geting and instance of an Office app?

loExcel = CreateObject("Excel.Application" )
WITH loExcel
.displayalerts=.f.
.Workbooks.Add
lcAuthor=.activeworkbook.author
.quit
ENDWITH
loExcel=.null.

?lcAuthor
 
Baltman,

Just an idea. Can you try to read the name from registry (licensed name). Because I think Excel gets Author name from registry (I might be wrong :) )

Regards

-- AirCon --
 
Hi

What I see is that the name is not in the registry. It is saved elsewhere, but I did not get time to explore.

However, better idea will be to take the name once and save it in a convenient place linked to the login in VFP application and use it every time, via the user logs in.

Rather depending on the names from elsewhere all the time, create the users portfolio once and use this associated with the applications login we make in the VFP. For the first time, probably, we can think of reading from windows and making the user key with long names etc. once, if it is new user. This will also help, since we cannot be sure that the user always has the Office products.

Just my opinion.

:)


____________________________________________
ramani - (Subramanian.G) :)
 
Hi,

I believe user information are stored in LDAP server? There must be some ways to extract it from there.

Peping
 
I looked through the registry, but didn't see anything there either.

Writing the name to a text file in the user's directory if that file doesn't exist, otherwise refering to that file should work well enough.

I know that Excel will be installed since that's where the output goes to anyway.

I would be interested in knowing what Windows/Office uses LDAP for...

Thanks,
Brian
 
Unfortunately I must assume that Active Directory Services are not available in my app's environment, and that the user's rights are pretty limited... [purple]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top