IE Back command?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: IE Back command?

  1. #1
    Join Date
    Nov 2004
    Location
    UK
    Posts
    185

    Question IE Back command?

    Hi All,

    I have the following code which checks my website for broken links.

    it currently get a link, puts it into the listbox, navigates to that link, and tries to find another link and so on.....

    Private Sub Command1_Click()
    Dim i As Integer

    List1.Clear 'clear listbox contents

    For i = 0 To IEObj.Document.links.length - 1
    List1.AddItem IEObj.Document.links(i).href
    Debug.Print IEObj.Document.links(i).href
    IEObj.Navigate IEObj.Document.links(i).href
    Next
    End Sub

    The question i have is that for example:

    root page = www.mycompany.com

    when it finds a page: i.e. www.mycompany.com/aboutus.htm
    it will browse to this location but then search throught that page, however i would want it to go back to www.mycompany.com, so my question is:

    is there a back command like the back button we have on the IE browser?

    Any ideas would be appreciated.
    Thankyou

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try IEObj.Document.history.go(-1)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Nov 2004
    Location
    UK
    Posts
    185
    Thanks for your reply Phil, unfortunatly when i tried IEObj.Document.history.go(-1), which i added after the navigate command i keep getting the error: Run time error 438 - object doesnt support this property or method? any ideas?

    Thanks agian
    Thankyou

  4. #4
    Join Date
    Oct 2005
    Location
    Staffordshire, England
    Posts
    101
    If your using a WebBrowser control then you can use
    Code:
    Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
    
    Select Case Button.key
        Case "Back"
            brwWebBrowser.GoBack
        Case "Forward"
            brwWebBrowser.GoForward
        Case "Stop"
            brwWebBrowser.Stop
        Case "Refresh"
            brwWebBrowser.Refresh
        Case "Home"
            brwWebBrowser.GoHome
        Case "Print"
            brwWebBrowser.SetFocus
            brwWebBrowser.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT
    End Select
    
    End Sub
    This on a ToolBar.
    I've been programming with VB for 15 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

    Martin2k

  5. #5
    Join Date
    Nov 2004
    Location
    UK
    Posts
    185
    Thanks a lot,

    got it working, was missing the command: IEObj.GoBack
    Thankyou

Similar Threads

  1. Replies: 4
    Last Post: 04-01-2005, 05:00 PM
  2. Replies: 4
    Last Post: 02-10-2002, 01:53 PM
  3. File i/o
    By choung in forum VB Classic
    Replies: 0
    Last Post: 11-23-2001, 02:19 PM
  4. ADO recordset retains old command text
    By Doug in forum VB Classic
    Replies: 0
    Last Post: 01-27-2001, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center