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 June 23rd, 2005, 01:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Getting HTML from IWebBrowserApp object?

I've opened a copy of IE from VB. I've directed it to a web site. Now how do I access the HTML for the page loaded?
 
Old July 14th, 2005, 01:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

I've managed to figure out how to do this. To avoid emails from others seeking a solution in the future, here's what I did:

' instantiate Browser Class
Dim ie As SHDocVw.InternetExplorerClass
ie = New SHDocVw.InternetExplorerClass()

' open browser window

Dim wb As IWebBrowserApp
wb = CType(ie, IWebBrowserApp)

' create an object so it can be referenced below for whatever reason
Dim ob As Object
ob = New Object()

' navigates to the specified URL
wb.Navigate(URLText, ob, ob, ob, ob)

' instantiating pointer to html document in browser
Dim htmlHTML As IHTMLDocument2 ' doesn't work for IHTMLDocument
htmlHTML = wb.Document

' and FINALLY you can get the HTML code
strHTML = UCase(htmlHTML.body.innerHTML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing HTML object in ASP.NET toddw607 ASP.NET 2.0 Basics 3 April 30th, 2008 03:58 PM
how to take tooltip object in HTML pushpa ASP.NET 1.0 and 1.1 Basics 6 May 11th, 2007 05:37 PM
problem Extracting Data using HTML Object Library method VB How-To 0 May 12th, 2006 02:52 AM
HTML Object in VB ivan603 VB How-To 0 March 6th, 2006 06:44 AM
Can you preload child html files to 1parent html? bekim Javascript How-To 4 January 22nd, 2005 04:17 PM





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