Check if URL exists, is so then return true

Hi everyone, I'm hoping someone can help with this function. it will check if a URL exists. If it does, would like it to return true and if it does not, then false.

Function Test_URLExists()
  Dim url As String
  
  url = "http://www.puresourcecode.com/"
  MsgBox url, vbInformation, URLExists(url)
  
  url = "http://www.puresourcecode.com/showthread.apx?t=1"
  MsgBox url, vbInformation, URLExists(url)
End Function

Function URLExists(url As String) As Boolean
    Dim Request As Object
    Dim ff As Integer
    Dim rc As Variant
    
    On Error GoTo EndNow
    Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
    
    With Request
      .Open "GET", url, False
      .Send
      rc = .StatusText
    End With
    Set Request = Nothing
    If rc = "OK" Then URLExists = True
    
    Exit Function
EndNow:
End Function

Happy coding!

Comments (38) -

Leah Kerr
8/15/2016 5:40:13 PM #

I got this site from my pal who informed me about this site and now this time I am browsing this web page and reading very informative content at this time.

Molly Mackenzie
8/24/2016 10:19:11 AM #

Howdy! I'm at work browsing your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the great work!

Alexandra Davies
10/18/2016 8:09:33 AM #

You completed some fine points there. I did a search on the subject matter and found mainly folks will go along with with your blog.

Andrew Roberts
10/20/2016 7:29:49 AM #

Wow! Thank you! I permanently needed to write on my website something like that. Can I take a portion of your post to my website?

Madeleine Hart
10/20/2016 4:11:50 PM #

My spouse and I stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to looking at your web page again.

Eric Turner
10/21/2016 12:07:07 AM #

Hi, I wish for to subscribe for this weblog to obtain hottest updates, so where can i do it please help out.

Leonard Nash
10/21/2016 12:09:27 AM #

Nice weblog here! Additionally your site quite a bit up very fast! What web host are you using? Can I am getting your associate link on your host? I want my website loaded up as fast as yours lol

Wendy Wilkins
10/21/2016 5:00:55 AM #

now what i came to realize about this issue is completely having a new idea and must be explored like you did it here

Colin Gray
10/21/2016 5:01:05 AM #

I really love your blog.. Pleasant colors & theme.

Adam Knox
10/21/2016 7:42:16 AM #

Hiya, I am really glad I have found this information. Nowadays bloggers publish only about gossip and net stuff and this is actually frustrating.

Dominic Rutherford
10/21/2016 10:20:42 PM #

I'm extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you customize it yourself? Either way keep up the excellent quality writing, it is rare to see a nice blog like this one these days..

Fiona Terry
10/21/2016 10:20:45 PM #

Good day! I could have sworn I've been to this website before but after reading through some of the post I realized it's new to me. Nonetheless, I'm definitely delighted I found it and I'll be bookmarking and checking back frequently!

Sophie Bower
10/22/2016 3:23:05 AM #

Wow! This could be one particular of the most beneficial blogs We've ever arrive across on this subject. Actually Excellent. I'm also an expert in this topic therefore I can understand your hard work.

Lucas King
10/22/2016 6:49:04 AM #

As a Newbie, I am always exploring online for articles that can benefit me. Thank you

Madeleine Sharp
10/22/2016 7:41:53 AM #

Out of interest, do you follow any SEO agencies? I can't find good info in anything which can be actioned Do you participate in any social sites?

Gavin Burgess
10/22/2016 1:34:06 PM #

It's remarkable to go to see this site and reading the views of all mates on the topic of this piece of writing, while I am also eager of getting familiarity.

Leah Turner
10/22/2016 5:10:53 PM #

Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how can we communicate?

Anna Thomson
10/23/2016 2:54:45 AM #

Great blog here! Also your website loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

Lillian McDonald
10/23/2016 1:47:41 PM #

Thanx for a very interesting site. What else may I get that type of info written in such a perfect way? I have a undertaking that I'm just now running on, and I have been on the look out for such information.

Tracey Fraser
10/23/2016 5:41:37 PM #

Hello! I'm at work browsing your blog from my new iphone 4! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the excellent work!

Elizabeth Black
10/23/2016 11:57:06 PM #

Woah! I'm really loving the template/theme of this blog. It's simple, yet effective. A lot of times it's challenging to get that "perfect balance" between usability and visual appearance. I must say you have done a great job with this. Also, the blog loads super fast for me on Safari. Excellent Blog!

Alexander Hamilton
10/24/2016 3:20:57 AM #

Woah! I'm really digging the template/theme of this website. It's simple, yet effective. A lot of times it's very difficult to get that "perfect balance" between usability and visual appeal. I must say you have done a fantastic job with this. Additionally, the blog loads very fast for me on Opera. Superb Blog!

Ruth Henderson
10/24/2016 3:21:39 AM #

This blog was... how do I say it? Relevant!! Finally I've found something which helped me. Kudos!

Piers Morrison
10/24/2016 12:35:58 PM #

I'm not sure why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists.

Richard Burgess
10/24/2016 12:36:02 PM #

Thanks for all of your effort on this site. My daughter really loves conducting research and it is easy to understand why. I know all concerning the powerful way you provide good techniques via your blog and even foster contribution from website visitors on the idea plus my child is now starting to learn a lot. Have fun with the remaining portion of the year. You have been performing a pretty cool job.

Wendy Marshall
10/24/2016 3:58:40 PM #

Hey I am so happy I found your blog, I really found you by mistake, while I was browsing on Google for something else, Nonetheless I am here now and would just like to say cheers for a fantastic post and a all round entertaining blog (I also love the theme/design), I don't have time to read it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the awesome work.

Luke Randall
10/24/2016 3:59:50 PM #

It is really a nice and helpful piece of information. I am happy that you just shared this useful info with us. Please stay us up to date like this. Thank you for sharing.

Grace Nolan
10/25/2016 12:07:08 AM #

Does your site have a contact page? I'm having a tough time locating it but, I'd like to send you an email. I've got some creative ideas for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it improve over time.

Luke Morrison
10/25/2016 12:07:13 AM #

Awesome read. I just passed this onto a friend who was doing some research on that. He actually bought me lunch because I found it for him! So let me rephrase: Thanks for lunch!

Stephen Buckland
10/25/2016 3:37:06 AM #

Hey there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a marvellous job!

Vanessa Coleman
10/25/2016 8:40:28 AM #

I am extremely inspired with your writing talents as well as with the structure to your weblog. Is that this a paid subject or did you modify it your self? Either way stay up the excellent high quality writing, it is rare to look a nice blog like this one today..

Karen Morrison
10/25/2016 1:32:56 PM #

Great write-up, I am a big believer in placing comments on sites to inform the blog writers know that they've added something advantageous to the world wide web!

Grace Smith
10/25/2016 1:33:08 PM #

Does your site have a contact page? I'm having a tough time locating it but, I'd like to shoot you an e-mail. I've got some recommendations for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it expand over time.

Eric Murray
10/25/2016 11:15:44 PM #

Thanks for any other informative website. The place else may just I am getting that type of info written in such an ideal approach? I've a project that I am just now running on, and I've been at the look out for such information.

Penelope Fisher
10/26/2016 5:52:20 AM #

Thank you a lot for sharing this with all folks you actually recognize what you're talking approximately! Bookmarked. Kindly also visit my web site =).

Julian MacLeod
10/26/2016 8:06:05 PM #

Thank you for your article post. Awesome.

Matt Ince
11/6/2016 7:20:40 AM #

Admiring the persistence you put into your site and in depth information you offer. It's awesome to come across a blog every once in a while that isn't the same old rehashed information. Fantastic read! I've bookmarked your site and I'm including your RSS feeds to my Google account.

Peter Rutherford
1/8/2017 9:35:59 AM #

I'm no longer positive where you are getting your information, however great topic. I must spend a while studying much more or figuring out more. Thank you for wonderful info I was in search of this information for my mission.

Add comment

Advertsing

125X125_06





MonthList

CommentList