Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default UserName Function: Not Working

I used this little trick in the office for a few recent projects:
http://www.j-walk.com/ss/excel/tips/tip94.htm

It works perfectly fine on the machines in the office, with the exception of
one machine. As far as I can tell, we have all the MS critical updates for
this machine. I found the advapi32.dll on the problem-machine too. I can't
figure out what it is. Any thoughts or suggestions?

Regards,
Ryan--


--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default UserName Function: Not Working

Hi,
What do you mean by it doesn't work:
- returns the wrong username
- an error pops up
- ...
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

I used this little trick in the office for a few recent projects:
http://www.j-walk.com/ss/excel/tips/tip94.htm

It works perfectly fine on the machines in the office, with the exception of
one machine. As far as I can tell, we have all the MS critical updates for
this machine. I found the advapi32.dll on the problem-machine too. I can't
figure out what it is. Any thoughts or suggestions?

Regards,
Ryan--


--
RyGuy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default UserName Function: Not Working

Oh yes, sorry, an error message pops up.
Any thoughts on what may cause this?

--
RyGuy


"sebastienm" wrote:

Hi,
What do you mean by it doesn't work:
- returns the wrong username
- an error pops up
- ...
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

I used this little trick in the office for a few recent projects:
http://www.j-walk.com/ss/excel/tips/tip94.htm

It works perfectly fine on the machines in the office, with the exception of
one machine. As far as I can tell, we have all the MS critical updates for
this machine. I found the advapi32.dll on the problem-machine too. I can't
figure out what it is. Any thoughts or suggestions?

Regards,
Ryan--


--
RyGuy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default UserName Function: Not Working

What error message?
We're not clairvoyant, you see........

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ryguy7272" wrote in message ...
| Oh yes, sorry, an error message pops up.
| Any thoughts on what may cause this?
|
| --
| RyGuy
|
|
| "sebastienm" wrote:
|
| Hi,
| What do you mean by it doesn't work:
| - returns the wrong username
| - an error pops up
| - ...
| --
| Regards,
| Sébastien
| <http://www.ondemandanalysis.com
|
|
| "ryguy7272" wrote:
|
| I used this little trick in the office for a few recent projects:
| http://www.j-walk.com/ss/excel/tips/tip94.htm
|
| It works perfectly fine on the machines in the office, with the exception of
| one machine. As far as I can tell, we have all the MS critical updates for
| this machine. I found the advapi32.dll on the problem-machine too. I can't
| figure out what it is. Any thoughts or suggestions?
|
| Regards,
| Ryan--
|
|
| --
| RyGuy


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default UserName Function: Not Working

Whoops, sorry again.; very tired now. I think the error says:
#NAME

I'm not at that workstation to test it now.

I was thinking it may be a corrupt dll file. Is that possible? Could the
'advapi32.dll' gotten corrupted and caused JWalk's function to create this
error? Doesn't XP just rebuild these types of corrupted dll files? I've
been using VBA for a couple of years and I haven't run into this before. I'm
baffled. Any insight would be appreciated.





--
RyGuy


"Niek Otten" wrote:

What error message?
We're not clairvoyant, you see........

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ryguy7272" wrote in message ...
| Oh yes, sorry, an error message pops up.
| Any thoughts on what may cause this?
|
| --
| RyGuy
|
|
| "sebastienm" wrote:
|
| Hi,
| What do you mean by it doesn't work:
| - returns the wrong username
| - an error pops up
| - ...
| --
| Regards,
| Sébastien
| <http://www.ondemandanalysis.com
|
|
| "ryguy7272" wrote:
|
| I used this little trick in the office for a few recent projects:
| http://www.j-walk.com/ss/excel/tips/tip94.htm
|
| It works perfectly fine on the machines in the office, with the exception of
| one machine. As far as I can tell, we have all the MS critical updates for
| this machine. I found the advapi32.dll on the problem-machine too. I can't
| figure out what it is. Any thoughts or suggestions?
|
| Regards,
| Ryan--
|
|
| --
| RyGuy





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default UserName Function: Not Working

What error message?

In the meantime, you may want to try this implementation, found on vbcode.com:

Public Function GetLoggedInUserName() as string
Dim cn As String
dim Name as String
Dim ls As Long
Dim res As Long

cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)

If res < 0 Then
name = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
Else
name = ""
End If

GetLoggedInUserName = Name
End function
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

Oh yes, sorry, an error message pops up.
Any thoughts on what may cause this?

--
RyGuy


"sebastienm" wrote:

Hi,
What do you mean by it doesn't work:
- returns the wrong username
- an error pops up
- ...
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

I used this little trick in the office for a few recent projects:
http://www.j-walk.com/ss/excel/tips/tip94.htm

It works perfectly fine on the machines in the office, with the exception of
one machine. As far as I can tell, we have all the MS critical updates for
this machine. I found the advapi32.dll on the problem-machine too. I can't
figure out what it is. Any thoughts or suggestions?

Regards,
Ryan--


--
RyGuy

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default UserName Function: Not Working

Thanks for taking a crack at it everyone. Still unsure what the problem is,
but I am going to use a different technique altogether.


Regards,
Ryan--


--
RyGuy


"sebastienm" wrote:

What error message?

In the meantime, you may want to try this implementation, found on vbcode.com:

Public Function GetLoggedInUserName() as string
Dim cn As String
dim Name as String
Dim ls As Long
Dim res As Long

cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)

If res < 0 Then
name = Mid(cn, 1, InStr(cn, Chr(0)) - 1)
Else
name = ""
End If

GetLoggedInUserName = Name
End function
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

Oh yes, sorry, an error message pops up.
Any thoughts on what may cause this?

--
RyGuy


"sebastienm" wrote:

Hi,
What do you mean by it doesn't work:
- returns the wrong username
- an error pops up
- ...
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"ryguy7272" wrote:

I used this little trick in the office for a few recent projects:
http://www.j-walk.com/ss/excel/tips/tip94.htm

It works perfectly fine on the machines in the office, with the exception of
one machine. As far as I can tell, we have all the MS critical updates for
this machine. I found the advapi32.dll on the problem-machine too. I can't
figure out what it is. Any thoughts or suggestions?

Regards,
Ryan--


--
RyGuy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ISBLANK function not working when cell is blank dut to function re mcmilja Excel Discussion (Misc queries) 9 May 7th 23 03:43 AM
What is the function for system to capture the username Dave VB logic for excel Excel Discussion (Misc queries) 4 March 7th 09 07:33 AM
Function to display username/networkname Hendrik.Kleine[_2_] Excel Programming 4 August 17th 07 02:28 PM
Newly created Get Function is not working when I copied the syntax from a working function CJ Excel Programming 1 January 16th 07 05:28 AM
Working with Arrays, pasing from function to function mikebres Excel Programming 2 April 27th 06 06:33 PM


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"