Clicking a button on a website

Jakarius31

New Member
Joined
Jan 6, 2020
Messages
2
Office Version
  1. 365
Platform
  1. 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:

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
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi, I should note that I've added the "End With" line of code after the "loop".
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,240
Members
453,026
Latest member
cknader

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