Sub Lire_sirene1()
Dim Url As String, Nb As Integer, idx As Integer
Dim Brut As Object
Dim Results As Object, Result As Object
Dim T As Variant
' Valeur obsolète
' https://data.opendatasoft.com/api/v2/catalog/datasets/sirene_v3%40public/records?start=0&rows=40&timezone=UTC&where=
' Valeur correcte
' https://data.opendatasoft.com/api/explore/v2.1/catalog/datasets/economicref-france-sirene-v3@public/records?start=0&rows=40&timezone=UTC&where=
BASE_SIRENE = Sheets("SireneV2").Range("B3").Value
On Error Resume Next
With Sheets("SireneV2")
.Range("B5").ClearContents
.Range("A7:L47").ClearContents
Url = BASE_SIRENE & .Range("B4").Value & .Range("F4").Value
'envoi demande
Set Brut = Obj_Rcdst1(Url)
'lecture nombre enregistrements
Nb = VBA.CallByName(Brut, "total_count", VbGet)
.Range("B5").Value = Nb
ReDim T(1 To Nb, 1 To 10)
'afectation objet results
Set Results = VBA.CallByName(Brut, "results", VbGet)
idx = 1
For Each Result In Results
T(idx, 1) = VBA.CallByName(Result, "enseigne1etablissement", VbGet)
T(idx, 2) = VBA.CallByName(Result, "adresseetablissement", VbGet)
T(idx, 3) = VBA.CallByName(Result, "denominationunitelegale", VbGet)
T(idx, 4) = VBA.CallByName(Result, "regionetablissement", VbGet)
T(idx, 5) = VBA.CallByName(Result, "siren", VbGet)
' T(idx, 6) = VBA.CallByName(Result, ... etc ...
idx = idx + 1
Next Result
.Range("B7").Resize(UBound(T, 1), UBound(T, 2)) = T
End With
Set Result = Nothing
Set Results = Nothing
Set Brut = Nothing
End Sub