Bonjour,

J'ai regardé le tutoriel, mais je ne pense pas avoir trouvé mon cas ci-dessous :
https://qwazerty.developpez.com/tuto...-et-vba-excel/

Merci de votre aide,

Je cherche à récupérer la donnée de la class "NBLUE2" ci-dessous :

Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
<div class="mainFont" id="mon_id">
<span class="NBLUE2" vl="80" vc="27" vr="3" vp="290" vt="O">Logmode:gdf454f5dg45dfg Systeme:DSHGFDHGFB458978</span>
<span vl="1" vc="107" vr="3" vp="370" vt="A" autoskip="1"></span>
<span class="NGREEN1" vl="25" vc="108" vr="3" vp="371" vt="O" autoskip=""></span>
<span vl="1" vc="1" vr="4" vp="396" vt="A"></span>
<span id="sb_relay">MonSysteme</span>
<span id="sb_print"></span>
<span id="sb_insert"></span>
<span id="sb_rtl"></span>
<span id="sb_cursor">12,40</span>
</div>

Code VBA : 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
'Déclaration des variables
Dim IEDoc As HTMLDocument
Dim IE As Object
Set IE = CreateObject("internetexplorer.application")
 
IE.navigate "https://emulation.com/mapage.htm"
IE.Visible = True
WaitIE IE
Set IEDoc = IE.document
 
'Dim HTMLElementStandard As HTMLGenericElement
Dim Texte1 As String
Dim Texte2 As String
 
    Texte1 = (IEDoc.getElementsByClassName("mainFont")(1).innerText)
    MsgBox Texte1, Title:="Texte 1 extrait de la page"
 
    Texte2 = (IEDoc.getElementsByClassName("NBLUE2")(1).innerText)
    MsgBox Texte2, Title:="Texte 2 extrait de la page"

Le texte 1 me donne tout le DIV...

J'ai un message d'erreur pour le texte 2 :
Erreur d'exécution 91 : variable objet ou variable de bloc with non définie