Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Check all URl's if the page source has this content

Hi,

I want help with a script that read all URL's in the file and check the page source and gives yes/No

This below line should be searched

<span style="font-size:12px;"><span style="font-family:arial,helvetica,sans-serif;">


Sample
http://tinyurl.com/bzl8lpb

Excel macro or a vbs would be helpful

regards
0
bsharath
Asked:
bsharath
  • 4
  • 2
1 Solution
 
bsharathAuthor Commented:
Thanks
I am not a programmer
Can you please help with the code?
0
 
krishnakrkcCommented:
Hi,

In a standard module

Dim objXH           As Object

Public Function kBool(URL As String) As Boolean


Dim strURL          As String
Dim strBody         As String

Const strKey        As String = "<span style=""font-size:12px;""><span style=""font-family:arial,helvetica,sans-serif;"">"

If objXH Is Nothing Then Set objXH = CreateObject("msxml2.xmlhttp")

With objXH
    .Open "get", URL, False
    .send
    strBody = .responseText
End With

kBool = CBool(InStr(1, strBody, strKey, 1))

End Function

Open in new window


and try

=kBool(A2)

where A2 hlds the URL

Kris
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
bsharathAuthor Commented:
Thanks
seems like it works

Have a query

does it check

<span style=""font-size:12px;""><span style=""font-family:arial,helvetica,sans-serif;"">

if available in page then TRUE?

As page source a few that it does not have this exact line is also shown as TRUE
0
 
krishnakrkcCommented:
this might be a performance issue. Rather than draging the formula go cell by cell.

Kris
0
 
bsharathAuthor Commented:
When the formulas are reading the screen freezes so it only gets to editable mode when the formulas have retrieved
0
 
bsharathAuthor Commented:
Anyway i can add 2 things to check within it?

Also any way to speed up?
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now