OLE – s – HTMLfile

This script uses OLE to create a HTMLfile object and

  • insert some HTML text in to that file,
  • scan the file for a specific HTML element by Id,
  • then scan the file for all elements with a given Tag name.

newscript
'
dim document = CreateObject("htmlfile")
'
document.write = "<html><head><title>test</title></head><body><div id='yo'>hello world</div><table><tr><td>Col-A</td><td>Col-B</td></tr></table></body></html>"
'
freestring = "Object by id = " & document.GetElementById("yo").innerHTML
dim allresults = document.getElementsByTagName("td")
dim result
'
For Each result In allresults
freestring = freestring & chr(0x0a) & "object = " & result.innerhtml
Next result
'
message = freestring