• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Get all HTML elements of a page

Svmaxcel

Member
I have a Intranet site, view source/Developer mode is disabled in IE.
No Chrome or Firefox.

Can someone please assist me how to get entire page source or HTML elements of a page as I have to automate the process of clicking CIA VBA
 
If the page does not use script to fill content. You could use something like...
Change oPath to output file of your choice.
Code:
Sub WebData()
    Dim oPath As String: oPath = "C:\Test\Export.txt"
    Dim intFF As Integer: intFF = FreeFile()
    With CreateObject("MSXML2.xmlHttp")
        .Open "GET", "http://yourwebsiteurl", False
        .send
        Open oPath For Output As #intFF
        Print #intFF, .responseText
        Close #intFF
    End With
End Sub

If using script. Then pilot IE like...
Code:
Dim oPath As String: oPath = "C:\Test\Export.txt"
Dim intFF As Integer: intFF = FreeFile()
With IE
'Your code to navigate to the page
Open oPath For Output As #intFF
Print #intFF, .Document.Body.innerHTML
Close #intFF
End With
 
Thanks a lot Chihiro for great help
When tested both xmlttp and ie, I have got different output in the text files.. Any idea why?
 

Normal as the request loads the initial webpage code
so before any webbrowser displays it after executing
any script loading some additional elements …​
 
Back
Top