Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2007, 02:13 PM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default IE open document reference

I need to scrape information from an open ASP page and plug it into a VB6 application. Can someone tell me how to refer to the currently open document in IE? There is lots of help to open a new URL, but I find nothing that relates to a web page currently open. Your help is appreciated.
 
Old December 30th, 2007, 08:47 AM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

'requires to add a reference to "Microsoft Internet Controls" -%systemroot%/system32/shdocvw.dll
Private Sub Form_Load()
    Dim IEWindows As SHDocVw.ShellWindows
    Dim IE As SHDocVw.InternetExplorer
    'Get a collection of all the running explorer and iexplorer windows
    Set IEWindows = New SHDocVw.ShellWindows

    For Each IE In IEWindows
        If IE.FullName = "C:\Program Files\Internet Explorer\iexplore.exe" Then 'if it's a iexplorer window
            Debug.Print IE.LocationURL 'will show the text in the address bar of the IE window
            Debug.Print IE.LocationName 'will show the text in the title bar of the IE window
            Debug.Print IE.Document.All.tags("td").length 'returns the number of <td> tags in the IE document
            'returns the text content of the first cell of first table in the webpage
            'use .innerHTML will return the html content of the first cell of the first table in the webpage
            Debug.Print IE.Document.All.tags("table")(0).cells(0).innerTex t
        End If
    Next
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open document, Open second doc and copy to first justabeginner Word VBA 1 March 7th, 2007 02:47 AM
Open pdf document ppenn Access VBA 1 February 20th, 2007 12:31 PM
document.open() issue fs22 Javascript 8 September 16th, 2004 09:07 PM
faild to open document polash Crystal Reports 0 March 22nd, 2004 06:18 PM
reference VB6 Microsoft word document exarkuun Pro VB 6 2 January 23rd, 2004 08:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.