Sub Recup_Data()
Dim Rcd As Object, Elm As Object, Fld As Object
Dim Chp As Variant, T As Variant, i As Integer, j As Integer
Dim tablo
Dim n As Integer
Chp = Array("reg_code", "region_min", "dep_code", "nom_dep_min", "date", _
"day_hosp", "day_intcare", "tot_out", "tot_death", "sex")
On Error Resume Next
Set Rcd = Obj_Rcdst(ActiveSheet.Range("A1").Value)
ReDim T(1 To Rcd.nhits, 1 To 11)
For Each Elm In VBA.CallByName(Rcd, "records", VbGet)
i = i + 1
Set Fld = VBA.CallByName(Elm, "fields", VbGet)
For j = 0 To 10
T(i, j + 1) = VBA.CallByName(Fld, Chp(j), VbGet)
Next j
Next Elm
With Sheets("Data")
.Range("A3:J10000").ClearContents
.Range("A3").Resize(UBound(T, 1), UBound(T, 2)) = T
.Range("A2:J" & UBound(T, 1) + 2).Sort key1:=Range("E2"), order1:=xlAscending, _
key2:=Range("J2"), order2:=xlAscending, Header:=xlYes
End With
Set Fld = Nothing
Set Elm = Nothing
Set Rcd = Nothing
tablo = Sheets("Data").Range("D3:D" & Sheets("Data").Range("D" & Rows.Count).End(xlUp).Row)
For n = LBound(tablo, 1) To UBound(tablo, 1)
tablo(n, 1) = UCase(OteAccents(tablo(n, 1)))
Next
Sheets("Data").Range("D3:D" & Sheets("Data").Range("D" & Rows.Count).End(xlUp).Row) = tablo
End Sub