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:
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: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
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..Set objGroupa = GetObject("LDAP://<redacted>/" &rng& "OU=Client Email Distribution Lists,DC=<redacted>,DC=co,DC=uk")
Any help would be hugely appreciated. Thanks
Last edited by MrSnoobs; 11-06-2010 at 07:29 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks