Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Get HTML code of a IE page

Posted on 2006-07-20
1
Medium Priority
?
224 Views
Last Modified: 2012-06-27
Hello Experts,

Using Visual how to get the Html contents of IE page. I am using this code

    Wb1.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
    ' copy the text to Clipboard
    Wb1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
    ' clear the selection
    Wb1.ExecWB OLECMDID_CLEARSELECTION, OLECMDEXECOPT_DONTPROMPTUSER
   
    'For Loopver = 1 To 100
    'sleep (10)
   ' Next
    Value1 = Clipboard.GetText(1)

but it is giving me only the things displayed on the page but i want the html code of it as i want to copy all the href contents.

How can i do this.

Thanks

vikas
0
Comment
Question by:vikas_maderna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
hes earned 1000 total points
ID: 17149158
Try this

'Add a reference to Microsoft Internet Controls

Option Explicit
Dim WithEvents Web1 As InternetExplorer
Dim TargetUrl As String
Dim blnComp As Boolean
Dim strHtml As String

' In your Code
Set Web1 = New InternetExplorer
Web1.Visible = True
TargetUrl = "http://www.experts-exchange.com ' Change to yout url
Web1.Navigate TargetUrl
blnComp = False

Do While blnComp = False
  DoEvents
Loop
strHtml = Web1.Document.body.innerHTML 'strHtml now contains the HTML of the page

Private Sub Web1_DocumentComplete(ByVal pDisp As Object, url As Variant)
 If url = TargetUrl Then
   blnComp = True
  End If
End Sub
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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