Code modification requested

tenda

New Member
Joined
Dec 17, 2014
Messages
37
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.

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.
 
Definitely YES .. this is exactly what's required .. now this code is a piece of "gold" : )

Thank you igold very much .. all the best ..
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You're welcome, we were happy to help. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,428
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top