ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   validating username and password in Active Directory (https://www.excelbanter.com/excel-programming/436583-validating-username-password-active-directory.html)

Josh

validating username and password in Active Directory
 
I am looking for help with the following task:

1. User clicks button on worksheet
2. Userform opens asking for username and password
3. The username and password information is verified against active directory
4. If username and password match AD, the user's initials are entered into a
particular cell
5. If username and password do not match AD, a msgbox advises the user of
the incorrect information.

I already have the userform created and know how to do the msgbox stuff, I
am just looking for the code to validate the user entered information to that
in AD.

Any suggesetions would be great.

Thanks in advance.

JP[_4_]

validating username and password in Active Directory
 
Does this work for you?

http://www.vbforums.com/showthread.php?t=352349

--JP

On Nov 24, 12:47*pm, josh wrote:
I am looking for help with the following task:

1. User clicks button on worksheet
2. Userform opens asking for username and password
3. The username and password information is verified against active directory
4. If username and password match AD, the user's initials are entered into a
particular cell
5. If username and password do not match AD, a msgbox advises the user of
the incorrect information.

I already have the userform created and know how to do the msgbox stuff, I
am just looking for the code to validate the user entered information to that
in AD.

Any suggesetions would be great.

Thanks in advance.


Josh

validating username and password in Active Directory
 
If I copy and paste that code, I get a "Syntax error" at the first line of
the code. Do I need to modify his code to work in VBA? Sorry for the
ignorance.


JP[_4_]

validating username and password in Active Directory
 
Yes, you can't set initial values like that in VBA. The default for
Boolean is False anyway. So change

Dim Success As Boolean = False

to

Dim Success As Boolean

--JP

On Nov 25, 7:17*am, josh wrote:
If I copy and paste that code, I get a "Syntax error" at the first line of
the code. *Do I need to modify his code to work in VBA? *Sorry for the
ignorance.


Josh

validating username and password in Active Directory
 
Thanks. After doing that I also get a syntax error on the next line of code:

Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://" & Domain,
Username, Password)

Any ideas?




JP[_4_]

validating username and password in Active Directory
 
Looks like I'm batting .1000. Turns out that code is for .NET, it
won't work in VBA at all.

Sample code:

http://www.freevbcode.com/ShowCode.Asp?ID=710
http://my.advisor.com/doc/08691
http://bytes.com/topic/access/answer...tory-usage-vba

You'll also want to check out the ADSI reference on MSDN (it's a COM
interface for use by non-.NET languages like VBA):

http://msdn.microsoft.com/en-us/libr...70(VS.85).aspx

--JP

On Nov 25, 10:22*am, josh wrote:
Thanks. *After doing that I also get a syntax error on the next line of code:

Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://" & Domain,
Username, Password)

Any ideas?




All times are GMT +1. The time now is 04:20 PM.

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