Solved

Help with checking search results on a website

Posted on 2012-12-29
5
332 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

920 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

11 Experts available now in Live!

Get 1:1 Help Now