View Single Post
  #9 (permalink)  
Old November 30th, 2005, 09:23 PM
echovue echovue is offline
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Alright - here you go, this will need a little tweaking but should get you the basic idea...

I have a form with a text box - txtAddress
                    a browser - ocxBrowser
                     a button - cmdGo

What it does it to take the source code of the page and saves it in a file C:\source.txt. I am thinking you could either just check the innerHTML property for whatever the code looks like on a page not found, or check out the contents of the file.

Code:
Option Compare Database
Option Explicit

    Dim objIE As SHDocVw.InternetExplorer
    Dim strURL As String
    Dim strFileName As String

Private Sub cmdGo_Click()
    strURL = txtAddress
    Set objIE = Me.ocxBrowser.Object
    objIE.Navigate strURL
End Sub


Private Sub Form_Load()
    strURL = "http://echovue.com/"
    Set objIE = Me.ocxBrowser.Object
    objIE.Navigate strURL
End Sub

Private Sub ocxBrowser_DownloadComplete()
    On Error Resume Next
    strFileName = "C:\Source.txt"
    Set objIE = Me.ocxBrowser.Object
    Open strFileName For Output As #1
    Print #1, objIE.Document.body.innerHTML
    Close #1
    txtAddress = objIE.LocationURL
    Beep
End Sub

Mike
EchoVue.com