参考网站得到以下程序用于取得网页中特定的链接,但是运行后,点击command1却出现错误,提示为"vdoc"的用户类型未定义,请教好心人帮帮忙,为什么会这样呢?难道不支持IHTMLDocument2对象?我用的vb6.0.谢谢!!
Option Explicit
Private m As BooleanPrivate Sub Form_Load()
WebBrowser1.Navigate "http://www.necepu.edu.cn"
End SubPrivate Sub Command1_Click()
If m Then
Dim vdoc As IHTMLDocument2
Set vdoc = WebBrowser1.Document
Dim aLink As HTMLLinkElement
Set aLink = vdoc.links(0)
aLink.Click
End If
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
m= True
End Sub
Option Explicit
Private m As BooleanPrivate Sub Form_Load()
WebBrowser1.Navigate "http://www.necepu.edu.cn"
End SubPrivate Sub Command1_Click()
If m Then
Dim vdoc As IHTMLDocument2
Set vdoc = WebBrowser1.Document
Dim aLink As HTMLLinkElement
Set aLink = vdoc.links(0)
aLink.Click
End If
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
m= True
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货