bonjour a tous

j'aimerais inverser le rol d'une fonction de Pierre Fauconnier

cette fonction me donne le texte de la colonne texte en fonction du id correspondant dans la colonne "id" d'un tableau structuré


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
Sub test1()
MsgBox getText("TxtC_1", "it")
End Sub
'
Function getText(ByVal ID As String, Language As String) As String
    Dim Formula As String
    getText = "self"
    On Error Resume Next
    Formula = "index(t_Caption[Text],match(1,(t_Caption[id]=""{id}"")*(t_Caption[language]=""{language}""),0))"
    Formula = Replace(Formula, "{id}", ID, , , vbTextCompare)
    Formula = Replace(Formula, "{language}", Language, , , vbTextCompare)
    Debug.Print Formula
    getText = Evaluate(Formula)
    On Error GoTo 0
End Function
je voudrais faire l'inverse a savoir injecter le texte et récupérer le id

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
Sub test2()
MsgBox getRef("Fichiers", "en")
End Sub
 
Function getRef(ByVal capt As String, Language As String) As String
    Dim Formula As String
    getRef = ""
    On Error Resume Next
    Formula = "index(t_Caption[ID],match(1,(t_Caption[Text]=""{Text}"")*(t_Caption[language]=""{language}""),0))"
    Formula = Replace(Formula, "{Text}", capt, , , vbTextCompare)
    Formula = Replace(Formula, "{language}", Language, , , vbTextCompare)
    Debug.Print Formula
   getRef = Evaluate(Formula)
    On Error GoTo 0
End Function
quelqu'un sait faire