The following code is cited from: How to open a list of URLs and save a screenshot of each on my secondary monitor using Excel VBA
It captures a screenshot for a list of urls which exists in Sheet1 ColA.
The outcome is a list of jpg files named sequentially "screenshot + number".
Is it possible to give every jpg file the name of its url instead of "/screenshot"?
Appreciating any valuable assistance with this request.
Many thanks in advance.
T.
It captures a screenshot for a list of urls which exists in Sheet1 ColA.
VBA Code:
Option Explicit
Public Sub Screenshots()
Dim d As WebDriver, urls(), i As Long
urls = Application.Transpose(ThisWorkbook.Worksheets("Sheet1").Range("A1:A200").Value) '<change this
Set d = New ChromeDriver
With d
.AddArgument "--headless"
.Start "Chrome"
.Window.Maximize
For i = LBound(urls) To UBound(urls)
If InStr(urls(i), "http") > 0 Then
.get urls(i)
.TakeScreenshot.SaveAs ThisWorkbook.Path & "/screenshot" & str(i) & ".jpg"
End If
Next
.Quit
End With
End Sub
The outcome is a list of jpg files named sequentially "screenshot + number".
Is it possible to give every jpg file the name of its url instead of "/screenshot"?
Appreciating any valuable assistance with this request.
Many thanks in advance.
T.