Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse html file using MSHTML in VBScript

I'd like to load a string as an html file using MSHTML in VBScript and parse it. I can do this with "InternetExplorer.application" but I'd like to do it with "htmlfile" (MSHTML.HTMLDocument)

The following code:

Set h =  CreateObject("htmlfile")
h.body.innerHTML = "html goes here"

gives this error:

Microsoft VBScript runtime error: Object required: 'body'

How do I load the html string?

like image 827
Eugene Avatar asked Oct 28 '25 09:10

Eugene


1 Answers

Probably cheating, but seems to work:

  Dim oHF : Set oHF = CreateObject("HTMLFILE")
  oHF.write "<html><body></body></html>"
  oHF.body.innerHTML = "<p>WhatEver</p>"
  WScript.Echo oHF.body.innerTEXT
like image 139
Ekkehard.Horner Avatar answered Oct 31 '25 00:10

Ekkehard.Horner