By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

FollowHyperlink Method-but don't show the window

Nathan H
100+
P: 104
I am trying to use the FollowHyperlink method to test the existence of a webpage. Everything works fine, but I do not want it to open the page in a browser, just test to whether it exists. Is there a way to do that, or should I be using a different method?

If it does not exist, I can use error handling to do what I want. If it exists the code keeps moving, but that darn window pops up.

Thanks
Dec 14 '07 #1
Share this Question
Share on Google+
3 Replies


FishVal
Expert 2.5K+
P: 2,653
Hi, Nathan.

Just a suggestion not supposed to be the best one.

Put to a form "Microsoft Web Browser" Activex control and make it invisible.

Form module code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnSearchPage_Click()
  2.     With Me
  3.         .Text1 = "Searching for page"
  4.         .WebBrowser0.Object.Navigate <..page URL..>
  5.     End With
  6. End Sub
  7.  
  8. Private Sub WebBrowser0_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
  9.     Me.Text1 = "Page found"
  10. End Sub
  11.  
  12. Private Sub WebBrowser0_NavigateError(ByVal pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
  13.     Me.Text1 = "Page not found"
  14. End Sub
  15.  
Dec 14 '07 #2

Nathan H
100+
P: 104
Hi, Nathan.

Just a suggestion not supposed to be the best one.

Put to a form "Microsoft Web Browser" Activex control and make it invisible.

Form module code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnSearchPage_Click()
  2.     With Me
  3.         .Text1 = "Searching for page"
  4.         .WebBrowser0.Object.Navigate <..page URL..>
  5.     End With
  6. End Sub
  7.  
  8. Private Sub WebBrowser0_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
  9.     Me.Text1 = "Page found"
  10. End Sub
  11.  
  12. Private Sub WebBrowser0_NavigateError(ByVal pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
  13.     Me.Text1 = "Page not found"
  14. End Sub
  15.  

Thanks FishVal. Your code worked, but did not error when the file was not available. As it brought up the error page of the website, and said "Page Found"

I put a bunch of IF THEN statements around the Application.ImportXML script to catch if the file was not available (and did away with the FollowHyperlink method) for this application.

Funny how things go though, I found even new uses and ideas with the code you provided...so all worked out!

Thanks for your input.
Dec 17 '07 #3

FishVal
Expert 2.5K+
P: 2,653
:)

I'm quite familiar with it. I consider coding to be a kind of adventure - you may easily get far-far away from where you have started dealing with things you've even never imagine before.

Good luck.
Dec 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.