Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with checking search results on a website

Posted on 2012-12-29
5
Medium Priority
?
342 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

618 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