I have some VB code that allows me to interrogate an LDAP database, but there are some "security group" group fields that I can't pull back.

The code is:

   Set objLDAP = GetObject("LDAP://[server details]")
    Set objConnection = CreateObject("ADODB.Connection")
    With objConnection
    .Provider = "ADSDSOObject"
    .Properties("ADSI Flag") = 0
    .Open "ADSI"
    End With
    Set objCommand = CreateObject("ADODB.Command")
    objCommand.ActiveConnection = objConnection

    objCommand.CommandText = "Select Uid,staffid,group,group, accessright from [server details]/ou=People' where objectclass = '*' and uid<='H*'"
    Set objRecordset = objCommand.Execute
'
    rc = objRecordset.RecordCount
    fc = objRecordset.fields.Count
    For x = 1 To rc
          Do Stuff
   Next x
When I export the LDAP data to a text file, it comes out as:

dn: uid=NameU, ou=People, o=server.name
staffid: 1616
uid: NameU
accessright: 2002
accessright: 2004
accessright: 2013
accessright: 2014
group: 310
group: 176
group: 215
group: 407
And that is basically what I want to be able to retrieve from LDAP directly into Excel.

Any ideas?