Extract Search Output from Website

BigRusty82

New Member
Joined
Jan 28, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a simple code that looks up from a sheet, to paste postcodes into a website then click a button. What i could really do with is then exporting the output into excel. The issue is sometimes if the postcode is found a dropdown box will appear, if it does not appear then just some text appears. I dont need to know the data in the box, just really a True or False if this happens or the output of the text.

This is the current code, it works up until the output part.

A postcode that brings a drop down is LE130AA and one that returns the text is NN4 7RG

VBA Code:
Sub FCC_GWC_Melton()

    Dim IE As Object
    Dim doc As HTMLDocument
    Set IE = CreateObject("InternetExplorer.Application")
    
    IE.Visible = True
    IE.navigate "https://www.gardenwasteclub.co.uk/melton/"

    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop
    
    Set doc = IE.document
    
    For intRow = 2 To 1407
    
    IE.Visible = True
    IE.navigate "https://www.gardenwasteclub.co.uk/melton/"

    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    
    Loop
        
        doc.getElementById("gwc-pc").Value = ThisWorkbook.Sheets("CODE").Range("A" & intRow).Value
        doc.getElementById("gwc-button").Click
        StrMsg = doc.getElementById("pc_msg")
        ThisWorkbook.Sheets("CODE").Range("B" & intRow).Value = StrMsg
           
        Application.Wait DateAdd("s", 2, Now)
        
    Next
    

End Sub

Any help would be greatly apricated. Thanks

BRS
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi,​
as you forgot to attach your worksheet and to elaborate the process to achieve on the website …​
 
Upvote 0
Hi, apologies. Mini-Sheet below,

GWC_Autofill.xlsm
A
1Postcode
2LE130AA
3LE130AB
4LE130AD
5LE130AE
6LE130AF
7LE130AG
8LE130AH
9LE130AJ
10NG130AA
11NG130AB
12NG130AD
13NG130AE
14NG130AF
15NG130AG
16NG130AH
17NG130AJ
CODE


The process to achieve this on the website is simply a text input into a box to click to get the results. Not sure how else to explain it. This will then cycle through the rows and return the result for each postcode.

Cheers

BRS
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,642
Members
452,663
Latest member
MEMEH

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