Точка останова ObjSysInfo во второй строке отображается как объект без переменных в окне просмотра. Как это обнаружить? Мы хотим выяснить, является ли пользователь частью псевдонима доступа.
Function GetADUserName() As String
Dim objSysInfo As Object, groups as variant
Set objSysInfo = CreateObject("ADSystemInfo") ' probably fails because I am not on a domain, just home group
If objSysInfo Is Nothing Then ' tried empty, null, same result.
MsgBox ("empty")
Else
MsgBox ("empty2") ' I get this one
End If
groups = GetMembers(objSysInfo.UserName) - this fails, no mapping between account names and security ids was done.
Set groups = GetMembers(objSysInfo.UserName)
For x = LBound(groups) To UBound(groups)
If groups(x) = "CN=BrdSoln-Infrastructure,OU=GroupID,OU=Groups,DC=mydomain,DC=com" Then
isMember = groups(x)
End If
Next x
If isMember = Empty Then
MsgBox ("You do not have necessary permission to view this content" & vbCrLf & "Please contact the team")
ActiveWorkbook.Sheets("Specification Matrix").Visible = xlSheetVeryHidden
Exit Function
Else
GetADUserName = isMember
End If
End Function
Заранее спасибо.