ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there anyway to retrieve Registry Values from VBA??? (https://www.excelbanter.com/excel-programming/400981-there-anyway-retrieve-registry-values-vba.html)

FunkySquid

Is there anyway to retrieve Registry Values from VBA???
 
I'm not sure if this is possible but I am trying to retieve my FULL
Name rather than my logon name from my PC. I was thinking of doing
this through the registry but I'm not sure if this is the best way.
Please help someone, I'm slowly going crazy!


Bob Phillips

Is there anyway to retrieve Registry Values from VBA???
 
It's not in the registry is it?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"FunkySquid" wrote in message
ups.com...
I'm not sure if this is possible but I am trying to retieve my FULL
Name rather than my logon name from my PC. I was thinking of doing
this through the registry but I'm not sure if this is the best way.
Please help someone, I'm slowly going crazy!




FunkySquid

Is there anyway to retrieve Registry Values from VBA???
 
Well I've searched for my full name in the registry and it shows up in
the following string:

HKEY_CURRENT_USER\Software\Inifiles\User Profile.ini\User Profile

"UserName" = "MyFullName"

Is there a way of retrieving this by using VBA or is there another way
to retrieve MyFullName from my computer?


JW[_2_]

Is there anyway to retrieve Registry Values from VBA???
 
Is it the Computer Name that you are after? If so:
Environ("computername")

FunkySquid wrote:
Well I've searched for my full name in the registry and it shows up in
the following string:

HKEY_CURRENT_USER\Software\Inifiles\User Profile.ini\User Profile

"UserName" = "MyFullName"

Is there a way of retrieving this by using VBA or is there another way
to retrieve MyFullName from my computer?



JLGWhiz

Is there anyway to retrieve Registry Values from VBA???
 
Do you have Administrator priviledges and are you on home or company
workstation? Also are you looking for VBA code to find the name or are you
looking for a way to modify the Registry?

"FunkySquid" wrote:

I'm not sure if this is possible but I am trying to retieve my FULL
Name rather than my logon name from my PC. I was thinking of doing
this through the registry but I'm not sure if this is the best way.
Please help someone, I'm slowly going crazy!



Bob Phillips

Is there anyway to retrieve Registry Values from VBA???
 
I think that will be because of some software that you have installed, I
don't have such a key on my machine.

The problem with any such value is that it relies on the user supplying that
info on some install, something which I wouldn't rely upon.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"FunkySquid" wrote in message
ups.com...
Well I've searched for my full name in the registry and it shows up in
the following string:

HKEY_CURRENT_USER\Software\Inifiles\User Profile.ini\User Profile

"UserName" = "MyFullName"

Is there a way of retrieving this by using VBA or is there another way
to retrieve MyFullName from my computer?




urkec

Is there anyway to retrieve Registry Values from VBA???
 
"FunkySquid" wrote:

Well I've searched for my full name in the registry and it shows up in
the following string:

HKEY_CURRENT_USER\Software\Inifiles\User Profile.ini\User Profile

"UserName" = "MyFullName"

Is there a way of retrieving this by using VBA or is there another way
to retrieve MyFullName from my computer?



If you need full name of a user account, you can use WinNT provider:

Sub WinNTtest()

Set objNetwork = CreateObject _
("Wscript.Network")

strComputer = objNetwork.ComputerName
'strUser = objNetwork.UserName
strUser = "baba"

Set objUser = GetObject("WinNT://" & _
strComputer & "/" & strUser & ", user")

Debug.Print objUser.get("FullName")

End Sub

If you want full name of a currently logged on user you can use strUser =
objNetwork.UserName to get user's name.

You can also use WMI service:

Sub WMItest()

strUser = "baba"

Set objWMIService = GetObject _
("WinMgmts:root\cimv2")

Set colUsers = objWMIService.ExecQuery _
("Select * From Win32_UserAccount " & _
"Where Name='" & strUser & "'")

For Each objUser In colUsers
Debug.Print objUser.FullName
Next

End Sub


If the user is in a domain you would use LDAP, but I don't have much
experience with that.

--
urkec


All times are GMT +1. The time now is 09:04 AM.

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