Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript to read HTML File

Status
Not open for further replies.

An0Ant

MIS
Oct 10, 2003
6
US
How can one use VBScript to read HTML file?

Of course it can be read as Text document,
but we want to use DOM (HTMLDocument, IHTMLBodyElement etc?)
so that the document can be parsed.

Following code works in VB with some undesirable effects
(launches IE)

===============
Set oH = New HTMLDocument

oH.url = "file://TestFile.HTM"

Set oB = oH.body
==================

We need to do this in VBScript if possible.

We tried following code but keep getting error on
each CreateObject (any variation)
=============================
Dim oH, oB

Set oH = CreateObject("HTMLDocument")
Set oH = CreateObject("MSHTML.HTMLDocument")
Set oH = CreateObject("MSHTMLCtl.HTMLDocument")

oH.url = "file://TestFile.HTM"
===========================

TIA
 
Hello An0Ant,

How about using InternetExplorer.Application and navigate to the url. You get the htmldocument within the container of the iexplorer whereas your script host still retain control on the document via body.getElementById, if the document properly or purposely formatted so. You can as well hook to the events. Though the IE is launched, it can remain invisible if so desired.

Just an idea...

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top