Bonjour,

J'ai réalisé le code suivant :
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
28
29
30
31
32
33
34
35
36
37
Sub MySub()
Dim GenericElem As HTMLGenericElement
 
Dim IE As New InternetExplorer
 
Dim htmlTabElement() As IHTMLElement
Dim PEE As IHTMLElement
 
 
URL_fonds = "http://… "
    IE.navigate URL_fonds
    Pause (4)
 
    Set GenericElem = IEDoc.body.all("content")
    htmlTabElement = getElementsByClassName(GenericElem, "tab0", False)
    Set PEE = htmlTabElement(0)
 
Set htmlTagCol = PEE.getElementsByTagName("a")
    Dim htmlTagCol_Croissance As HTMLGenericElement
    Set htmlTagCol_Croissance = htmlTagCol(3)
    Dim htmlTagCol_Ouvert As HTMLGenericElement
    Set htmlTagCol_Ouvert = htmlTagCol(6)
    Call Télécharge_CSV_Titre(htmlTagCol_Croissance)    
  ...
 
End Sub
 
 
Sub Télécharge_CSV_Titre(ByVal index As HTMLGenericElement)
    Dim htmlTagCol_Historique As IHTMLElementCollection
    Dim GenericElem As HTMLGenericElement
    Set GenericElem = index
    GenericElem.Click
    Pause (4)
   Set htmlTagCol_Historique = IEDoc.getElementsByTagName("a")
...
End Sub

A coup d'espions et de points d'arrêt je m'aperçois que, dès la ligne 34, mes variables htmlTagCol_Croissance et htmlTagCol_Ouvert perdent leur contenu.

Or j'en ai besoin dans la suite du code de Mysub

A quoi est-ce dû et comment y remédier ?

Merci d'avance pour vos réponses .