FrankieGTH
New Member
- Joined
- May 29, 2021
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hello all,
I've been using the same VBA for years that opens IE, selects everything in the browser, copies it and pastes into Excel.
Further to this, I create a loop whereby the URL updates in H1 and loops to scrape multiple pages, it's been super useful for handling all types of websites over the years.
With the phasing out of IE and more and more websites not being compatible with IE, this VBA is becoming past its sell by date.
I have very limited IT skills, but through Googling have become aware of Selenium and have just barely managed to use the code in the website linked to open a browser.
This code works, but I am completely out of my depth what to do next.
I'd be ever so grateful if the above code could be adapted to work in a similar vain to the IE VBA up top, one that refers to a URL in a cell. I'd use the code for various websites, so I'm not looking to scrape a specific table(s) with a website.
Kind Regards,
Frankie
I've been using the same VBA for years that opens IE, selects everything in the browser, copies it and pastes into Excel.
VBA Code:
URL = Sheets("Links").Range("H1")
Dim IE As Object
'Dim document As Object
Set IE = CreateObject("internetexplorer.application")
With IE
.Visible = True
.Navigate URL
Call Application.Wait(Now + TimeValue("0:00:05"))
Do Until .ReadyState = 4: DoEvents: Loop
Do While .ReadyState <> 4
DoEvents
Loop
.ExecWB 17, 2
.ExecWB 12, 2
ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
False, NoHTMLFormatting:=True
Further to this, I create a loop whereby the URL updates in H1 and loops to scrape multiple pages, it's been super useful for handling all types of websites over the years.
With the phasing out of IE and more and more websites not being compatible with IE, this VBA is becoming past its sell by date.
I have very limited IT skills, but through Googling have become aware of Selenium and have just barely managed to use the code in the website linked to open a browser.
VBA Code:
Sub Test()
Dim bot As New WebDriver
Dim Body As String
bot.Start "chrome", "https://www.google.co.uk/"
bot.Get "/"
End Sub
This code works, but I am completely out of my depth what to do next.
I'd be ever so grateful if the above code could be adapted to work in a similar vain to the IE VBA up top, one that refers to a URL in a cell. I'd use the code for various websites, so I'm not looking to scrape a specific table(s) with a website.
Kind Regards,
Frankie