Recuperer les infos pour un utilsateur en vba

[Fermé]
Signaler
Messages postés
113
Date d'inscription
lundi 19 janvier 2009
Statut
Membre
Dernière intervention
10 juin 2011
-
Bonjour,

Voici mon bout de code
je recupere les info de tous les users dans la base, Moi je veux juste recuperer les infos pour un User
Comment faire ? je suis debutant en VBA.

Private Sub DbUserControl_Click()
Dim res As Integer
Dim AdmSession As AdminSession
Dim i As Integer
Dim user As OAdUser
Dim users() As String
Dim miscInfos As String

On Error GoTo HandleError
Set AdmSession = Session.GetAdminSession()

i = 0
For Each user In AdmSession.users
If user.Active Then
ReDim Preserve users(i)
users(i) = user.Name
i = i + 1
End If
Next

users = Utils.SortArray(users)

On Error Resume Next
For i = 0 To UBound(users)
Cells(FirstRow + i, LastNameCol).Activate
Set user = AdmSession.GetUser(users(i))
' Cells(FirstRow + i, UserIDCol).value = user.Name
'Cells(FirstRow + i, LastNameCol).value = AD.GetLastNameFromFullName(user.fullname)
' Cells(FirstRow + i, FirstNameCol).value = AD.GetFirstNameFromFullName(user.fullname)
' Cells(FirstRow + i, EmailCol).value = user.Email
'Cells(FirstRow + i, PhoneCol).value = user.Phone

' miscInfos = user.MiscInfo


' Cells(FirstRow + i, InitialPasswdCol).value = getMiscInfo(miscInfos, "IPwd")
'Cells(FirstRow + i, IntExtCol).value = getMiscInfo(miscInfos, "IE")
' Cells(FirstRow + i, ServiceCol).value = getMiscInfo(miscInfos, "Ser")
' Cells(FirstRow + i, CompanyCol).value = getMiscInfo(miscInfos, "Cie")
' Cells(FirstRow + i, LocalisationCol).value = getMiscInfo(miscInfos, "Loc")
'Cells(FirstRow + i, UCOrConnectTypeCol).value = getMiscInfo(miscInfos, "UC")

Cells(FirstRow + i, DBUsersCol) = Join(GetUserDBNames(Cells(FirstRow + i, UserIDCol).value), DBUsersSeparator)

If user.SuperUser Then Range(Cells(FirstRow + i, UserIDCol), _
Cells(FirstRow + i, UCOrConnectTypeCol)).Font.Color = RGB(100, 20, 230)
Next
Cells(FirstRow + i, LastNameCol).Activate
Err.Clear

HandleError:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "Exception"
End If

End Sub
je