+ Reply to Thread
Results 1 to 1 of 1

Thread: Put variable in to LDAP path

  1. #1
    Registered User
    Join Date
    11-06-2010
    Location
    London, UK
    MS-Off Ver
    Excel 2010
    Posts
    2

    Put variable in to LDAP path

    Hey all

    I am having trouble structuring a Sub that will take the value from a combo-box, use this as a variable and then place it in to an LDAP path. I know that my sub is wrong and that it will need restructuring but I am unsure how. It's been breaking my brain! Current code follows:

    Sub ListMembersOfDistGroup()
    
    Dim objGroupa, ObjMembera, count, rng
    count = 0
    
    Set rng = ComboBox1.Value
    
    Set objGroupa = GetObject("LDAP://<redacted>/OU=Client Email Distribution Lists,DC=<redacted>,DC=co,DC=uk")
        
        For Each ObjMembera In objGroupa.Members
                        Sheets(1).Cells(count + 15, 1).Value = Mid(ObjMembera.Name, 4)
                        count = count + 1
           Next
        Sheets(1).Cells(14, 3).Value = count
        
    End Sub
    What I have tried to do is break the ldap path and add the declared variable in the middle of it but no such luck:

    Set objGroupa = GetObject("LDAP://<redacted>/" &rng& "OU=Client Email Distribution Lists,DC=<redacted>,DC=co,DC=uk")
    In addition, I am sure that I am wrong about fetching the value from the combobox as well, as I get a mismatch error at this point in the code..

    Any help would be hugely appreciated. Thanks
    Last edited by MrSnoobs; 11-06-2010 at 07:29 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0