VBA Help: Extracting website information with Internet Explorer

ExcelRooky91

New Member
Joined
Apr 3, 2018
Messages
10
Hi all,

I'm a VBA rookie and I have only just begun my dive into this deep realm of new learnings due to the limitation of formulas.

I’m attempting to use VBA to open internet explorer, click a search button, then extract the tabled information presented.

The website is: https://www.nzfma.org/data/search.aspx

The code I have so far only opens the website. I have played around with different commands I have read on the forums to try and click the “search” button.

The two search criteria on the webpage: “Search for” & “date” pre-populate correctly (being "Bank Bill Reference Rates" & Today's date) so I don’t think I need to define these which makes it easier.

I think I know how to automatically save the work book down, and I can open the website, I’m just lacking the knowledge to do the steps in between haha. My basic code is below.

If anyone is able to provide some guidance or coding help it would be much appreciated.

Kind regards,
ExcelRooky91

Code:
[Sub Automate_IE_Load_Page()
'To load the webpage in IE
    Dim i As Long
    Dim URL As String
    Dim IE As Object
    Dim objElement As Object
    Dim objCollection As Object
 
    'Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")
 
    'Set IE.Visible = True so as to make IE visible
    IE.Visible = True
 
    'Define URL
    URL = "[URL]https://www.nzfma.org/data/search.aspx[/URL]"
 
    'Navigate to URL
    IE.Navigate URL
   
       Do
DoEvents
Loop Until IE.ReadyState = 4
End Sub
/CODE]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
to click a button, you need to figure out what the button's ID is in the html. you can navigate to the website and press f12, which should open the developer window. then click the inspect element button. Once you get the button's ID you can use the syntax -
Code:
IE.document.getElementById("button_id_goes_here").click
 
Upvote 0
to click a button, you need to figure out what the button's ID is in the html. you can navigate to the website and press f12, which should open the developer window. then click the inspect element button. Once you get the button's ID you can use the syntax -
Code:
IE.document.getElementById("button_id_goes_here").click

Thank you sir! This has sent me on my way to the next hurdle. Much appreciated
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,047
Members
449,064
Latest member
scottdog129

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