Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Using MSHTML Offline

$
0
0
I'm new to MSHTML.
I wanted to load a htm or html file (saved offline) into a text box to see how it parsed.
The object browser works correctly when entering code so no reference problem to MSHTML.
I wrote this simple function but keeps erroring on "Object or With Block Not Set"

Code:

Public Function getHTMLFile(strFile As String) As String
'Opens a htm or html "file" and parses the Text

Dim objDocument As MSHTML.HTMLDocument
Set objDocument = New MSHTML.HTMLDocument

'This supposedly tidys up the HTML prior to parsing?
'objDocument.body.outerHTML = strFile      '"Object or With Block Not Set"    --- Rem for now

objDocument.body.innerHTML = strFile        '"Object or With Block Not Set"
getHTMLFile = objDocument.body.innerText


objDocument.Close
Set objDocument = Nothing

End Function


Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>