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 38 39 40 41
|
Sub Go()
MyUrl = "http://bourse.lesechos.fr/bourse/synthese.jsp?code=FR0010557264&place=XPAR&codif=ISIN"
Set web = CreateObject("InternetExplorer.Application")
web.Navigate MyUrl
Do While web.Busy
Loop
On Error Resume Next
Set doc = Nothing
Do Until Not doc Is Nothing
Set doc = web.Document
Loop
strWebPage = doc.body.OuterHTML
'web.Quit
GetData = strWebPage
Cours = "<td class=""b12-tab-int b12-tab-bold"">Cours</td>"
Pos = InStr(1, GetData, Cours, vbTextCompare) + Len(Cours)
Chaine = Mid(GetData, Pos)
Valorisation = InStr(1, Chaine, "valorisation"">", vbTextCompare) + Len("valorisation"">")
Pos = InStr(111, Chaine, "</TD>") - Valorisation
Cours = Mid(Chaine, Valorisation, Pos)
MsgBox "Cours = " & Cours
Objectif = "<td>Objectif de cours à trois mois</td>"
Pos = InStr(1, Chaine, Objectif, vbTextCompare) + Len(Objectif)
Chaine = Mid(Chaine, Pos)
Objectif = "<TH style=""FONT-WEIGHT: normal"">"
FinPos = InStr(1, Chaine, Objectif, vbTextCompare) + Len(Objectif) - 1
Chaine = Mid(Chaine, 1 + FinPos)
Objectif = Mid(Chaine, 1, InStr(1, Chaine, "</TH", vbTextCompare) - 2)
MsgBox Objectif
Potentiel = "b12-rouge"
Pos = InStr(1, Chaine, Potentiel, vbTextCompare) + Len(Potentiel) + 1
Chaine = Mid(Chaine, Pos)
Pos = InStr(1, Chaine, "</TH>") - 1
Potentiel = Mid(Chaine, 1, Pos)
MsgBox Potentiel
web.Quit
End Sub |