Is there any way to automatically use the NT ID / Pasword in a VBA Procedure?

Sthrncali

Board Regular
Joined
Apr 1, 2011
Messages
226
I don't want to see them myself or assign them to variables... I have a connection string thats fetching data from a Remedy Server and in the connection string in VBA I can assign the UserID / Password within the connection string...

However its several users that would be using the file so I was hoping there maye be an API call or something like that that will automatically supply the current users Username / Password to the server I am logging into?

I know like when I am logging into my SQL server using MS SQL Studio 2005 there is a checkbox for "Use NT Credentials" so I don't have to manually type in my User/PW.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
The current username you can get with this:
Code:
Dim Username as String
UserName = Environ("USERNAME")
You can get many other useful properties this way, searching via Google will get you a list somewhere, but the password is not one of them (obviously). If the connection you talk about needs the current user's credentials, have you tried by not supplying them at all? Maybe the connection then defaults to the user's credentials without you needing to supply them, because Windows takes care of that behind the screens (might be wishful thinking here, not sure).
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,792
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top