我遇到了VBA WebBrowser控件的简单问题
wb.Navigate "http://www.google.com"
装载正常。我希望在显示控件之前抓住页面,然后设法操纵wb的dom
Private Sub wb_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
Dim doc As HTMLDocument
Set doc = wb.Object.Document
Dim node As Variant
Set node = doc.getElementById("color-red")
If Not node Is Nothing Then
node.parentNode.removeChild (node)
End If
Exit Sub
问题是原始页面仍在显示,直到修改接管为止。它有点闪烁,我想删除。
控件在显示之前没有""事件,以便可以使用该事件进行自定义控制,拦截WIN消息?或其他解决方案?非常感谢,