Je veux bien pour les dix dernières perfs et aussi de m'expliquer si je veux changer le nombre.
#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
' partants
Range("A1").CurrentRegion.Offset(1, 1).Clear
txt = HtmlGet([_www])
tbl = Split(txt, [_split])
For i = LBound(tbl) + 1 To UBound(tbl)
Range("B" & i + 1) = "https://www.geny.com" & Split(Split(tbl(i), [_pre])(1), [_post])(0)
Next
' pour mise en cache du navigateur
nav = ShellExecute(0, "open", "https://www.qwant.com/", 0, 0, 1)
With Sheets("urls")
For i = 2 To .Range("B" & Rows.Count).End(xlUp).Row
nav = ShellExecute(0, "open", .Range("B" & i), 0, 0, 1)
Next
End With
Application.Wait (Now + TimeValue("00:00:12"))
SendKeys "%{F4}"
' suppression des feuilles éventuelles
Application.DisplayAlerts = False
For Each sh In Worksheets
If sh.Name Like "c*" Then sh.Delete
Next
Application.DisplayAlerts = True
' interrogation des sources et collecte des informations
With Sheets("urls")
Set sh = ActiveWorkbook.Sheets.Add(After:=ActiveWorkbook.Worksheets(ActiveWorkbook.Worksheets.Count))
sh.Name = Split([_www], "_")(1)
For i = 2 To .Range("B" & Rows.Count).End(xlUp).Row
Range("A" & 20 * (i - 2) + 1) = i - 1
Range("A" & 20 * (i - 2) + 2) = Split(Split(.Range("B" & i), "/")(UBound(Split(.Range("B" & i), "/"))), "_")(0)
Range("B" & 20 * (i - 2) + 2).Select
Application.Wait (Now + TimeValue("00:00:01"))
nav = ShellExecute(0, "open", "https://www.qwant.com/", 0, 0, 1)
Application.Wait (Now + TimeValue("00:00:03"))
SendKeys "%d"
Application.Wait (Now + TimeValue("00:00:03"))
SendKeys "view-source:" & .Range("B" & i)
SendKeys "{ENTER}"
Application.Wait (Now + TimeValue("00:00:04"))
SendKeys "^a"
Application.Wait (Now + TimeValue("00:00:02"))
SendKeys "^c"
Application.Wait (Now + TimeValue("00:00:02"))
MyData.GetFromClipboard
txt = MyData.GetText(1)
If InStr(txt, [_avant]) <> 0 Then
txt = [_avant] & Split(Split(txt, [_avant])(1), [_apres])(0) & [_apres]
SendKeys "%{F4}"
MyData.SetText Text:=Empty
MyData.PutInClipboard
MyData.SetText txt
MyData.PutInClipboard
Application.Wait (Now + TimeValue("00:00:02"))
ActiveSheet.Paste
der = Application.Max(Range("B" & Rows.Count).End(xlUp).Row, 20 * (i - 2) + 4 + [_nb])
Rows(20 * (i - 2) + 3 + [_nb] & ":" & der).Delete Shift:=xlUp
End If
Next
End With
Sheets("modèle").Cells.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
MsgBox "Terminé !"
End Sub
Pour changer le nombre ... onglet paramètres