?
Solved

WebBrowser Control Source code

Posted on 2005-04-07
3
Medium Priority
?
248 Views
Last Modified: 2006-11-18
Is there a way of pulling the source code out of a webbrowser control?

I know you can use the inet control, however its a dynamic application, which uses previous screens to compile the final resulting page, once this page is reached, I want to be able to read the final page, and use it.

Any ideas?

Tony
0
Comment
Question by:tonelm54
3 Comments
 
LVL 13

Accepted Solution

by:
rettiseert earned 2000 total points
ID: 13731983
Do you mean the HTML code of the current page in the control?

WebBrowser1.Document.documentElement.outerhtml
0
 
LVL 4

Expert Comment

by:cachedVB
ID: 13732008
Hi tonelm54,

rettiseert's code is what you are looking for.  If you want to save it to disk, here is a good function for doing so.

Sub SaveWebBrowser(WB As WebBrowser, ByVal FileName As String, _
    Optional SaveAsPlainText As Boolean)
    Dim Text As String, fnum As Integer

    If SaveAsPlainText Then
        Text = BW.Document.Body.innerHTML
    Else
        Text = BW.Document.documentElement.OuterHTML
    End If

    ' save to file
    fnum = FreeFile
    Open FileName For Output As #fnum
    Print #fnum, Text;
    Close #fnum
End Sub    

cachedVB
0
 

Author Comment

by:tonelm54
ID: 13732024
OK quickest repsonse EVER! Thanks, and yes!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question