ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting Users Name (https://www.excelbanter.com/excel-programming/353031-getting-users-name.html)

fastmonkey512[_3_]

Getting Users Name
 

Hi all

I've used a bit of code from the M$ site that grabs the users name
using a windows API

The code is from here http://support.microsoft.com/?kbid=161394

There are about 10 people who all use this spreadsheet and everything
works fine, but on 1 PC it does not get the user name and it doesn't
matter who logs in

Has anyone else used that bit of code before, and seen this happen.

All it seems to do it leave the Var LpName with 256 spaces and no
name.:confused:


--
fastmonkey512
------------------------------------------------------------------------
fastmonkey512's Profile: http://www.excelforum.com/member.php...o&userid=23982
View this thread: http://www.excelforum.com/showthread...hreadid=511253


Steve

Getting Users Name
 
I use this:

http://www.mvps.org/access/api/api0008.htm

No problems experienced yet but, it is a tad s-l-o-w.


"fastmonkey512"
wrote in message
news:fastmonkey512.231esm_1139614802.2992@excelfor um-nospam.com...

Hi all

I've used a bit of code from the M$ site that grabs the users name
using a windows API

The code is from here http://support.microsoft.com/?kbid=161394

There are about 10 people who all use this spreadsheet and everything
works fine, but on 1 PC it does not get the user name and it doesn't
matter who logs in

Has anyone else used that bit of code before, and seen this happen.

All it seems to do it leave the Var LpName with 256 spaces and no
name.:confused:


--
fastmonkey512
------------------------------------------------------------------------
fastmonkey512's Profile:
http://www.excelforum.com/member.php...o&userid=23982
View this thread: http://www.excelforum.com/showthread...hreadid=511253




Jim Thomlinson[_5_]

Getting Users Name
 
Have you tried using environ("UserName") something like this (instead of the
API)

msgbox environ("UserName")

Not to sure why the API would fail but it would have more to do with the
Operating system than Excel...
--
HTH...

Jim Thomlinson


"fastmonkey512" wrote:


Hi all

I've used a bit of code from the M$ site that grabs the users name
using a windows API

The code is from here http://support.microsoft.com/?kbid=161394

There are about 10 people who all use this spreadsheet and everything
works fine, but on 1 PC it does not get the user name and it doesn't
matter who logs in

Has anyone else used that bit of code before, and seen this happen.

All it seems to do it leave the Var LpName with 256 spaces and no
name.:confused:


--
fastmonkey512
------------------------------------------------------------------------
fastmonkey512's Profile: http://www.excelforum.com/member.php...o&userid=23982
View this thread: http://www.excelforum.com/showthread...hreadid=511253



fastmonkey512[_4_]

Getting Users Name
 

Cheers guy's

I'll give them both a try when I back at work.

If I ever figure why the API doesn't work on this one PC I'll post it
here (but don't hold your breath)

Colin


--
fastmonkey512
------------------------------------------------------------------------
fastmonkey512's Profile: http://www.excelforum.com/member.php...o&userid=23982
View this thread: http://www.excelforum.com/showthread...hreadid=511253



All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com