It contains 1499 members from the get go. However I still don't know if the
issue is the array, or the LDAP query. Somewhere there must be a size limit
as I know there at least 1600 members of the AD group. I also added people
to the group, and it still came up with 1499.
"joel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Usually collection have a length property. Rather than keep on redim
> the array size in a loop get the length property and redim only onced
> befor you read the data.
>
> I'm not sure if this is going to work. What you should do is to add as
> a watch item : objGroup. Highlight the variable with the mouse and
> right click. select Watch. Then step through the code using F8. when
> you step pass the Getobject statement the wath item will contain data
> and you can look at the object : objGroup.Member. Look at the prperties
> and see if it contains the 1600 items you are expecting.
>
>
> Sub ADGroupMembers()
> Dim arrNames()
> intSize = 0
>
> 'Let's clear the range first
> Range("SCREEN").ClearContents
>
> 'Get the AD Group Info for BATY-SESCREEN
> Set objGroup = GetObject("LDAP://CN= BATY-SESCREEN,OU=Security
> Groups,DC=baty,DC=com")
>
> 'Getting User Names and increase the array size
> objlength = objGroup.Member.length
> ReDim Preserve arrNames(objlength)
> For Each strUser In objGroup.Member
> Set objuser = GetObject("LDAP://" & strUser)
> arrNames(intSize) = objuser.CN
> intSize = intSize + 1
> Next
>
> 'In order to sort, we have to convert to Uppercase.
> For i = (UBound(arrNames) - 1) To 0 Step -1
> For j = 0 To i
> If UCase(arrNames(j)) > UCase(arrNames(j + 1)) Then
> strHolder = arrNames(j + 1)
> arrNames(j + 1) = arrNames(j)
> arrNames(j) = strHolder
> End If
> Next
> Next
>
> 'Fill the SESCREEN range with the array values
> Range("SESCREEN").Value = WorksheetFunction.Transpose(arrNames)
>
> End Sub
>
>
> --
> joel
> ------------------------------------------------------------------------
> joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
> View this thread:
> http://www.thecodecage.com/forumz/sh...d.php?t=199906
>
> http://www.thecodecage.com/forumz
>