Option Explicit
Private Sub Command1_Click()
Dim d As HTMLDocument
WebBrowser1.Navigate ("about:blank")
Dim htmlstr As String
htmlstr = "
"
Set d = WebBrowser1.Document
Dim flag As Boolean
flag = False
Do Until flag
DoEvents
If d Is Nothing Then
Resume
Else
flag = True
htmlstr = htmlstr + RichTextBox1.Text + ""
d.body.innerHTML = htmlstr
d.body.Style.background = "url(E:/xxxx/111/src/bh_image.jpg)"
End If
Loop
End Sub
Private Sub Form_Load()
RichTextBox1.Text = "ABCDEF"
End Sub
在d = WebBrowser1.Document的时候总感觉取实例不一定成功,还有错误提示,所以就循环了一下,就能取到内容,这是为什么?
阅读(1304) | 评论(0) | 转发(0) |