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

[RESOLVED] Convert a string into a ''HTML'' object

$
0
0
Hello,

I have a HTML Document with 2 Links. The entire HTML document is a string.
How can I convert the String into a HTML object?

I tried ...
Set o.body.document = zz
but it fails.

I want to use a MsgBox ...
MsgBox o.body.document.getElementsByTagName("Link").length
to retrieve the number of links which are contained in the body.



'Set a Reference to "Microsoft HTML Object Library"
Dim o As MSHTML.HTMLDocument

Private Sub Form_Load()

Dim zz As String
zz = "<html>"
zz = zz & vbCrLf
zz = zz & "<body>"
zz = zz & vbCrLf
zz = zz & "<a href=http://google.com>Link_1"
zz = zz & vbCrLf
zz = zz & "<a href=http://bing.com>Link_2"
zz = zz & vbCrLf
zz = zz & "</body>"
zz = zz & vbCrLf
zz = zz & "</html>"

'Set o.body.document = zz
'Set o.body = zz
'o.write zz

MsgBox zz
'MsgBox o.body.document.getElementsByTagName("Link").length

End Sub

Viewing all articles
Browse latest Browse all 21238

Trending Articles