FollowHyperlink Method-but don't show the window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan H
    New Member
    • Nov 2007
    • 104

    FollowHyperlink Method-but don't show the window

    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
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    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.

    [code=vb]
    Private Sub btnSearchPage_C lick()
    With Me
    .Text1 = "Searching for page"
    .WebBrowser0.Ob ject.Navigate <..page URL..>
    End With
    End Sub

    Private Sub WebBrowser0_Nav igateComplete2( ByVal pDisp As Object, URL As Variant)
    Me.Text1 = "Page found"
    End Sub

    Private Sub WebBrowser0_Nav igateError(ByVa l pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
    Me.Text1 = "Page not found"
    End Sub
    [/code]

    Comment

    • Nathan H
      New Member
      • Nov 2007
      • 104

      #3
      Originally posted by FishVal
      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.

      [code=vb]
      Private Sub btnSearchPage_C lick()
      With Me
      .Text1 = "Searching for page"
      .WebBrowser0.Ob ject.Navigate <..page URL..>
      End With
      End Sub

      Private Sub WebBrowser0_Nav igateComplete2( ByVal pDisp As Object, URL As Variant)
      Me.Text1 = "Page found"
      End Sub

      Private Sub WebBrowser0_Nav igateError(ByVa l pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
      Me.Text1 = "Page not found"
      End Sub
      [/code]

      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.Imp ortXML 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.

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        :)

        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.

        Comment

        Working...