Citation Envoyé par JackOuYA Voir le message
Bonjour,

commence par rajouter la référence "Microsoft Html objet Library" à ton projet.

puis la fonction :
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
17
18
'
' YaChercheHtlm
'recherche un "HtmlElement" en fonction de son nom et valeur :
'
Function YaChercheHTmlEl(yaNom As String, yaValeur As String, yaEL As IHTMLElement, YaDoc As HTMLDocument) As Boolean
  On Error GoTo yaErreur
  Dim mYaEL As IHTMLElement
        For Each mYaEL In YaDoc.getElementsByName(yaNom)
          If mYaEL.Value = yaValeur Then
             Set yaEL = mYaEL
             YaChercheHTmlEl = True
             Exit Function
          End If
        Next
yaErreur:
YaChercheHTmlEl = False
 
End Function
et pour l'appel dans ton code :

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
17
18
19
20
21
22
23
24
25
26
27
...
      Loop 'attend la fin du chargement
 
    Dim yaEL As IHTMLElement
        If YaChercheHTmlEl("precision", "", yaEL, IE.Document) Then
           yaEL.Value = "922752"
        Else
           MsgBox "Erreur sur Ecriture numero de licence"
           Exit Sub
        End If
        If YaChercheHTmlEl("reqid", "200", yaEL, IE.Document) Then '200 MAsculin, 300 Feminin
           yaEL.Checked = True
        Else
           MsgBox "Erreur sur Ecriture sur choix sexe"
           Exit Sub
        End If
         If YaChercheHTmlEl("submit", "Envoyer", yaEL, IE.Document) Then '200 MAsculin, 300 Feminin
            yaEL.Click
        Else
           MsgBox "Erreur sur Click sur envoyer"
           Exit Sub
        End If
 
    End With
 
 
End Sub
Bonjour, j'utilise ce code qui fonctionne bien mais je rencontre un problème dès lors que je n'arrive pas à connaître le nom du champ à remplir. Existerait-il un moyen de lister les champs (i.e. : champ texte) d'une form internet
Merci de votre aide