Searching Object Properties

faradhi

Registered User.
Local time
Today, 20:46
Joined
Mar 7, 2002
Messages
13
I have this function code that I know will not work. What I hope to accomplish is that the function is passed the property name and it returns a propery value.

Code:
Function GetProp(StrPropName As String, StrLDAP As String)

    Dim Objuser As Object
    'Opens the LDAP object for the active directory user
    Set Objuser = GetObject(StrLDAP)
    
    GetProp = Objuser.StrPropName

End Function
 
You can't just use a variable as a substitute for a property or method of an Object.

Try something like this:
Code:
Function GetProp(strPropName As String, strLDAP As String) As String

    Dim Objuser As Object
    'Opens the LDAP object for the active directory user
    Set Objuser = GetObject(StrLDAP)
    
    GetProp = Objuser.Properties(StrPropName)

End Function
 
Thanks SJ

I knew it was something stupidly simply. I just could not remember how.
 
Well that didn't work either. States that the object doesn't support this property or method. Any other suggestions???
 

Users who are viewing this thread

Back
Top Bottom