ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   complication between VB syntax and Object Value with [-] minus character (https://www.excelbanter.com/excel-programming/387032-complication-between-vbulletin-syntax-object-value-%5B-%5D-minus-character.html)

Eldi Munggaran

complication between VB syntax and Object Value with [-] minus character
 
I'm trying to fetch data from "Active Directory",
the process are :

strQuery = "SELECT AdsPath FROM
'LDAP://ou=xxx,ou=yyy,ou=zzz,dc=ct,dc=abcdefg,dc=net'"
objCommand.CommandText = strQuery
Set objRecordSet = objCommand.Execute
Set objUser = GetObject(objRecordSet.Fields("AdsPath").Value)

Do Until objRecordSet.EOF
formMain.lbstatus.Caption = "Fetching data " & i - 4 & " of " &
objRecordSet.RecordCount
formMain.Repaint
Set objUser = GetObject(objRecordSet.Fields("AdsPath").Value)
ThisWorkbook.ActiveSheet.Cells(i, 3).Value = objUser.cn ' NICK USER NAME
ThisWorkbook.ActiveSheet.Cells(i, 4).Value =
objUser.displayName'LOGIN NAME
ThisWorkbook.ActiveSheet.Cells(i, 5).Value = objUser.sn 'LAST NAME
ThisWorkbook.ActiveSheet.Cells(i, 6).Value = objUser.Title 'TITTLE
ThisWorkbook.ActiveSheet.Cells(i, 7).Value = objUser.mail ' EMAIL Address
ThisWorkbook.ActiveSheet.Cells(i, 8).Value = objUser.msExchIMAddress'
im MAIL Address
ThisWorkbook.ActiveSheet.Cells(i, 9).Value =
objUser.cvx-SourcingCompany 'SourcingCompany

objRecordSet.MoveNext
i = i + 1
Loop



The problem happen when I'm trying to fetch cvx-SourcingCompany, it's
seems like complication between VB syntax and Object Value when using
character "-" that VB think objectUser.cvx [minus] SourcingCompany.

Any Suggestion ?


All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com