VB calls WebBrowser skills set 2

zhaozj2021-02-16  90

Several methods of writing HTML content to WebBrowser

First join in Form_Load

WebBrowser1.naviGate "About: blank"

Make sure WebBrowser1 is available

method 1:

DIM S AS STRING DIM STREAM As IStream S = "" S = S "" S = S "" S = S "

Hello World

s = s "" "

s = s "

WebBrowser1.document.write s

Method 2:

Dim o set o = webbrowser1.document.selection.createralge debug.print o if (not o is nothing) Then O.Pastehtml "Haha" set o = Nothing endiff

Method 3:

'Insert text box DIM O

Set o = webbrowser1.document.selection.createraNGE O.Execcommand "InsertTextArea", False, "XXX"

Method 3 is a method of calling execcommand and delivering a control command. You can also insert a picture element such as a picture through this method. Details can refer to the MSDN's execCommand command.

转载请注明原文地址:https://www.9cbs.com/read-12206.html

New Post(0)