Help with checking search results on a website

bsharath used Ask the Experts™
Hello all,

I need help to identify which URL's have results

Please go to

You can see there are results

Then this where there are no 0 results

I want help with a vbs script or excel macro i can have these URL's in a txt file or a excel in a column that can read each URL and tell me True or False

If there are results found or not for the search
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I went to you first link and it was searching for recieve which is spelled correctly and returns results.

I went to you 2nd link and it was searching for recomend which is spelled incorrectly and it should not return any results.

So the search on the site seems to working fine.

For which your words online with search keys, you can use below online site which can open more than 50 urls in less than 3 seconds
Hi, bsharath.

I suspect that the attached will take the record for the slowest way to produce your results. The code is...
Option Explicit

Sub Check_URLS()
Dim i           As Long
Dim xResult     As String
Dim xCell       As Range
Dim xLast_Row   As Long

Sheets("Check URL's").Activate

xLast_Row = Range("A1").SpecialCells(xlLastCell).Row

If xLast_Row < 2 Then
    MsgBox ("No data found - run cancelled.")
    Exit Sub
End If

Range("B2:B" & xLast_Row).ClearContents

For Each xCell In Range("A2:A" & xLast_Row)
    If xCell <> "" Then
        i = i + 1
        xResult = Get_URL(xCell.Value)
        xResult = "N/A"
    End If
    xCell.Offset(0, 1) = xResult
    Application.ScreenUpdating = True

End Sub

Function Get_URL(xUrl As String)
Dim xTempSheet  As Worksheet
Dim xConnection As String
Dim xFound      As Range

Application.ScreenUpdating = False

Set xTempSheet = Sheets.Add
xConnection = "x" & Format(Now(), "hhmmss")

On Error Resume Next

    With xTempSheet.QueryTables.Add(Connection:="URL;" & xUrl, Destination:=Range("$A$1"))
        .Name = xConnection
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

On Error GoTo 0
Dim fred
Set fred = xTempSheet.QueryTables(1)

If xTempSheet.Range("A1").SpecialCells(xlLastCell).Row = 1 Then
    Application.DisplayAlerts = False
    Application.DisplayAlerts = True
    Get_URL = "N/A"
    Exit Function
End If

Set xFound = xTempSheet.Range("A:A").Find(What:="Your search yielded no results", LookIn:=xlFormulas, LookAt:=xlPart _
                , SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If xFound Is Nothing Then
    Get_URL = "False"
    Get_URL = "True"
End If

Application.DisplayAlerts = False
Application.DisplayAlerts = True

End Function

Open in new window



Thanks a lot Brian works perfectly
Was a time saver
Thank you

Any help with this
Thanks, bsharath.

Sorry, I'd looked at the other one but I'm afraid that webby stuff is beyond me.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial