Solved

Help with checking search results on a website

Posted on 2012-12-29
5
331 Views
Last Modified: 2012-12-29
Hello all,

I need help to identify which URL's have results

Please go to

http://alturl.com/mseg7

You can see there are results

Then this where there are no 0 results
http://alturl.com/w5579

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
0
Comment
Question by:bsharath
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Yagya Shree
ID: 38729245
Hi,

I went to you first link and it was searching for recieve which is spelled correctly and returns results.
http://www.techyv.com/search/node/recieve

I went to you 2nd link and it was searching for recomend which is spelled incorrectly and it should not return any results.
http://www.techyv.com/search/node/recomend

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

http://www.urlopener.com/index.php
0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38729608
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)
    Else
        xResult = "N/A"
    End If
    
    xCell.Offset(0, 1) = xResult
    
    Application.ScreenUpdating = True
    
Next

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
        xTempSheet.Delete
    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"
Else
    Get_URL = "True"
End If

Application.DisplayAlerts = False
    xTempSheet.Delete
Application.DisplayAlerts = True

End Function

Open in new window

Regards,
Brian.Check-URL-s-II.xlsm
0
 
LVL 11

Author Comment

by:bsharath
ID: 38729621
Thanks a lot Brian works perfectly
Was a time saver
Thank you

Any help with this
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27980557.html
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38729647
Thanks, bsharath.

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

Author Comment

by:bsharath
ID: 38729653
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now