I have to extract data from a web database with VBA, to do that there is a page web, where we can put the tag (that we can choose) and see the data saved (the web page : http://ift.tt/2cWD3Ms) Now, I made a VBA macro (the code below) to access to the web page, write in the input text the proper tag and click on submit button, and i can see the data (on string form) on the web navigator
THE PROBLEM is when i want to copy the String to VBA (extract it) the code give me sentences and strings from the previous web page (which keep the same URL) how can i read the new page pls?
Dim htmlForm As HTMLFormElement
Dim HtmlElementStandard As HTMLGenericElement
Dim LeTexteExtrait As String
Set htmldoc = ie.document
Set oDoc = ie.document
' Valeur recherchée
oDoc.getElementsByName("tag")(0).Value = "trait"
oDoc.getElementsByTagName("form")(0).submit
'Allons chercher ce texte dans notre Item46
Dim iet As New InternetExplorer
Set ie = ie
Set htmldoc = ie.document
'ie.Refresh
Set HtmlElementStandard = htmldoc.body.all(0)
'On le place dans notre variable prévue à cet effet
LeTexteExtrait = HtmlElementStandard.innerText
'On affiche le texte
MsgBox LeTexteExtrait, Title:="Le texte extrait de la page"
End Sub
Thank you !! :)
Aucun commentaire:
Enregistrer un commentaire