Jakarius31
New Member
- Joined
- Jan 6, 2020
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi,
I'm trying to write a macro to open a website and carry out a search for the location within a Cell in my workbook.
The website is the British Geological Survey. Geology of Britain viewer | British Geological Survey (BGS)
Typical when I open the website I have to click the button near the top right corner "Go to Location", then type in the postcode, hit "Search for location", then i would also like to press the button on the left "Superficial Only". I'm trying to automate this process.
So far I have manged to get the postcode as a string from the address in Excel, and open the website. But I'm struggling with the next parts.
Can someone advise as to how to click the buttons?
My code so far is:
Thanks in advance for any advice!
Jak
I'm trying to write a macro to open a website and carry out a search for the location within a Cell in my workbook.
The website is the British Geological Survey. Geology of Britain viewer | British Geological Survey (BGS)
Typical when I open the website I have to click the button near the top right corner "Go to Location", then type in the postcode, hit "Search for location", then i would also like to press the button on the left "Superficial Only". I'm trying to automate this process.
So far I have manged to get the postcode as a string from the address in Excel, and open the website. But I'm struggling with the next parts.
Can someone advise as to how to click the buttons?
My code so far is:
VBA Code:
Sub BGSwebsite()
Dim Address As String
Address = ActiveCell
LResult = Right(Address, 8)
MsgBox LResult
Const Url$ = "http://mapapps.bgs.ac.uk/geologyofbritain/home.html"
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.navigate Url
.Visible = True
Do
DoEvents
Loop Until ie.ReadyState = 4
End Sub
Thanks in advance for any advice!
Jak