Au risque de me faire incendier par des puristes, voici la solution assez alambiquée avec excel pour récupérer le code source !
Tu lances, tu ne touches à rien, tu vas boire un café ou tu vas pi...er.
A comparer avec la simplicité de la solution google sheets qui me séduit de plus en plus (solution utilisant le langage XPath)
#If VBA7 Then
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#Else
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
#End If
Sub telecharger()
Dim nav As Long, MyData As DataObject
Set MyData = New DataObject
Dim page As New HTMLDocument, elem As Object
fenetre = ActiveWindow.Caption
nav = ShellExecute(0, "open", "https://www.qwant.com/", 0, 0, 1)
Application.Wait (Now + TimeValue("00:00:02"))
For ligne = 2 To Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
url = Sheets(1).Cells(ligne, 1)
SendKeys "%d"
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "view-source:" & url
SendKeys "{ENTER}"
Application.Wait (Now + TimeValue("00:00:10"))
SendKeys "^a"
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "^c"
Application.Wait (Now + TimeValue("00:00:01"))
MyData.GetFromClipboard
txt = MyData.GetText(1)
' version DOM
page.body.innerHTML = txt
For Each elem In page.getElementsByTagName("div")
If elem.getAttribute("id") = "VL" Then Sheets(1).Cells(ligne, 2) = elem.innerHTML
Next
Next
fin
Application.Wait (Now + TimeValue("00:00:02"))
AppActivate fenetre & " - Excel"
End Sub
Sub fin()
Open Environ("TEMP") & "\" & "fin" & ".htm" For Output As #1
Print #1, "<html><body>Fin du traitement, retour sur excel ...</body></html>"
Close #1
ShellExecute 0, "open", Environ("TEMP") & "\" & "fin" & ".htm", vbNullString, "C:\TEMP\", 1 'SW_SHOWNORMAL
End Sub