ztek
asked on
AxWebBrowser fill HTML
I am using AxWebBrowser and need to find out how to feed it html.
like so AxWebBrowser = " <html>" & _
" <head>" & _
" <title>" & _
" Hello World Demonstration Document" & _
" </title>" & _
" </head>" & _
" <body>" & _
" <h1>" & _
" Hello, World!" & _
" </h1>" & _
" " & _
" <p>" & _
" This is a minimal "hello world" HTML document. It demonstrates the" & _
" basic structure of an HTML file and anchors." & _
" </p>" & _
" <p>" & _
" For more information, see the HTML Station at: <a href=" " & _
" http://www.december.com/html/">http://www.december.com/html/</a>" & _
" </p>" & _
" <hr>" & _
" <address>" & _
" " & _
" © <a href="http://www.december.com/john/">John December</a> (<a" & _
" href="mailto:john@december .com">john @december. com</a>) / 2001-04-06" & _
" </address>" & _
" </body>" & _
" </html>"
and have it display correctly
Current Code:
IECollection.Navigate2("ab out:blank" )
While Not IECollection.ReadyState = SHDocVw.tagREADYSTATE.READ YSTATE_COM PLETE
Application.DoEvents()
End While
Dim oIETasks As mshtml.IHTMLDocument2 = DirectCast(IECollection.Do cument, mshtml.IHTMLDocument2)
oIETasks.body.innerHTML = sHeader & sPage & sFooter
Cursor.Current = Cursors.Arrow
like so AxWebBrowser = " <html>" & _
" <head>" & _
" <title>" & _
" Hello World Demonstration Document" & _
" </title>" & _
" </head>" & _
" <body>" & _
" <h1>" & _
" Hello, World!" & _
" </h1>" & _
" " & _
" <p>" & _
" This is a minimal "hello world" HTML document. It demonstrates the" & _
" basic structure of an HTML file and anchors." & _
" </p>" & _
" <p>" & _
" For more information, see the HTML Station at: <a href=" " & _
" http://www.december.com/html/">http://www.december.com/html/</a>" & _
" </p>" & _
" <hr>" & _
" <address>" & _
" " & _
" © <a href="http://www.december.com/john/">John December</a> (<a" & _
" href="mailto:john@december
" </address>" & _
" </body>" & _
" </html>"
and have it display correctly
Current Code:
IECollection.Navigate2("ab
While Not IECollection.ReadyState = SHDocVw.tagREADYSTATE.READ
Application.DoEvents()
End While
Dim oIETasks As mshtml.IHTMLDocument2 = DirectCast(IECollection.Do
oIETasks.body.innerHTML = sHeader & sPage & sFooter
Cursor.Current = Cursors.Arrow
ASKER
I have also done that. I have a javascript that changes the title of the page and i catch the event. But after the event is triggered once it will not trigger again. that is my problem.
Can you give an example of the code which you are actually using?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok here is what i have
dim sHTML as string
shtml = " <HTML> <HEAD> <meta name=vs_targetSchema content='http://schemas.microsoft.com/intellisense/ie5'> <style type='text/css'> body { border: 0; background: buttonface; overflow: hidden; margin: 0; } .scrollTable { border-left: 0px solid buttonshadow; border-right: 0px solid buttonhighlight; border-top: 0px solid buttonshadow; border-bottom: 0px solid buttonhighlight; background: window; width: 100%; overflow: hidden } .scrollTableHead { background: buttonface; width: 100%; overflow: hidden; } .scrollTableHead table { background: buttonface; empty-cells: show; table-layout: fixed; } .scrollTableHead table td { border-left: 1px solid buttonhighlight; border-right: 1px solid buttonshadow; border-top: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; } .scrollTableHead td, .scrollTableBody td { color: windowtext; font: icon; padding: 2px; } .scrollTableBody { overflow: auto; /* height needs to be calculated from scrollTable */ width: 100%; } </style> <style> .thead TD { BACKGROUND: #D4D0C8; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color:#000000; } .thead { BACKGROUND: #D4D0C8; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbody { BACKGROUND: #ffffff; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbodyICO { BACKGROUND: #f5f5f5; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbodyLOA { BACKGROUND: #9daac2; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodySumm { BACKGROUND: #D4D0C8; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : #800000; } .tbodyLate { BACKGROUND: #e0e0e0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } A.Link { COLOR: navy; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; CURSOR: hand; TEXT-DECORATION: underline; } .tbodyMarkB { BACKGROUND: #ffffe0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodyTotal { BACKGROUND: #eeeeee; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodyMidTotal { BACKGROUND: #fffff0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .Link { COLOR: navy; TEXT-DECORATION: underline; CURSOR: hand; } </style> <style> .tbody1 { BACKGROUND: #ffffff; BORDER-BOTTOM: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbody2 { BACKGROUND: #FDF5E6; BORDER-BOTTOM: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-RIGHT: #FDF5E6 1px solid; BORDER-TOP: #FDF5E6 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySB { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #C1D2EE 1px solid; BORDER-RIGHT: #C1D2EE 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySL { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #316AC5 1px solid; BORDER-RIGHT: #C1D2EE 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySR { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #C1D2EE 1px solid; BORDER-RIGHT: #316AC5 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } </style> <script language='javascript'> var SPID = 0; var SCL = ''; function SelectRow(PID,CCL,Customer AcctNumber ){ if (SPID!=0){ document.all('td1_' + SPID).className = SCL; document.all('td2_' + SPID).className = SCL; document.all('td3_' + SPID).className = SCL; document.all('td4_' + SPID).className = SCL; document.all('td5_' + SPID).className = SCL; document.all('td6_' + SPID).className = SCL; document.all('td7_' + SPID).className = SCL; document.all('td8_' + SPID).className = SCL; document.all('td9_' + SPID).className = SCL; } document.all('td1_' + PID).className = 'tbodySL'; document.all('td2_' + PID).className = 'tbodySB'; document.all('td3_' + PID).className = 'tbodySB'; document.all('td4_' + PID).className = 'tbodySB'; document.all('td5_' + PID).className = 'tbodySB'; document.all('td6_' + PID).className = 'tbodySB'; document.all('td7_' + PID).className = 'tbodySB'; document.all('td8_' + PID).className = 'tbodySB'; document.all('td9_' + PID).className = 'tbodySB'; if (SPID == PID){ parent.parent.document.tit le = CustomerAcctNumber } SPID = PID; SCL = CCL; } </script> </HEAD> <BODY bgcolor='#D4D0C8' scroll='no' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'> <div class='scrollTable' id='testScrollTable'> <span class='scrollTableHead'> <table cellspacing='0' width='100%' cellpadding=0 id='Header'> <thead class=thead> <tr> <td align=center width='35'><nobr>#</nobr>< /td> <td align=center ><nobr> </nobr></td> <td align=center ><nobr> </nobr></td> <td align=left ><nobr>Account #</nobr></td> <td align=left ><nobr>Customer Name</nobr></td> <td align=left ><nobr>Rep.</nobr></td> <td align=left ><nobr>Submit Date</nobr></td> <td align=left ><nobr> </nobr></td> <td align=left ><nobr>Note</nobr></td> </tr> </thead> </table> </span> <span class='scrollTableBody'> <table cellspacing='0' width='100%' cellpadding=0> <tbody class=tbody> <tr id='4971'> <td id='td1_4971' class='tbody2' align=center nowrap width='35' onclick=SelectRow('4971',' tbody2','A ccount_720 697')>1</t d> <td id='td2_4971' class='tbody2' align=center nowrap><IMG align=absMiddle alt='Status' border=0 height=16 src='\\pcsweb\d$\pcsprogra ms\boomboo m\bin\Whee lRed.gif' width=20 ></td> <td id='td3_4971' class='tbody2' align=center nowrap><IMG align=absMiddle alt='Priority' border=0 height=16 src='\\pcsweb\d$\pcsprogra ms\boomboo m\bin\Flag Green.gif' width=20 ></td> <td id='td4_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','A ccount_720 697')>7206 97</td> <td id='td5_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','A ccount_720 697')>MRS Mary Jones</td> <td id='td6_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','A ccount_720 697')>char mainek</td > <td id='td7_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','A ccount_720 697')>7/1/ 2005</td> <td id='td8_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','T ask_4971_7 20697')><I MG align=absMiddle alt='4971' border=0 height=16 src='\\pcsweb\d$\pcsprogra ms\boomboo m\bin\Note .gif' width=20 onclick=SelectRow('4971',' tbody2','T ask_4971') ></td> <td id='td9_4971' class='tbody2' align='left' nowrap onclick=SelectRow('4971',' tbody2','A ccount_720 697')>cust clld and went over her bill and it doesnt sho</td> </tr> </tbody> </table> </span></div> </BODY> </HTML> "
Cursor.Current = Cursors.AppStarting
With IECollection
.Navigate("about:blank")
Do While .ReadyState <> SHDocVw.tagREADYSTATE.READ YSTATE_COM PLETE
Application.DoEvents()
Loop
.Document.open()
.Document.write(sHTML)
.Document.close()
End With
Cursor.Current = Cursors.Arrow
dim sHTML as string
shtml = " <HTML> <HEAD> <meta name=vs_targetSchema content='http://schemas.microsoft.com/intellisense/ie5'> <style type='text/css'> body { border: 0; background: buttonface; overflow: hidden; margin: 0; } .scrollTable { border-left: 0px solid buttonshadow; border-right: 0px solid buttonhighlight; border-top: 0px solid buttonshadow; border-bottom: 0px solid buttonhighlight; background: window; width: 100%; overflow: hidden } .scrollTableHead { background: buttonface; width: 100%; overflow: hidden; } .scrollTableHead table { background: buttonface; empty-cells: show; table-layout: fixed; } .scrollTableHead table td { border-left: 1px solid buttonhighlight; border-right: 1px solid buttonshadow; border-top: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; } .scrollTableHead td, .scrollTableBody td { color: windowtext; font: icon; padding: 2px; } .scrollTableBody { overflow: auto; /* height needs to be calculated from scrollTable */ width: 100%; } </style> <style> .thead TD { BACKGROUND: #D4D0C8; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color:#000000; } .thead { BACKGROUND: #D4D0C8; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbody { BACKGROUND: #ffffff; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbodyICO { BACKGROUND: #f5f5f5; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; } .tbodyLOA { BACKGROUND: #9daac2; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodySumm { BACKGROUND: #D4D0C8; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : #800000; } .tbodyLate { BACKGROUND: #e0e0e0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } A.Link { COLOR: navy; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; CURSOR: hand; TEXT-DECORATION: underline; } .tbodyMarkB { BACKGROUND: #ffffe0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodyTotal { BACKGROUND: #eeeeee; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .tbodyMidTotal { BACKGROUND: #fffff0; BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; color : black; } .Link { COLOR: navy; TEXT-DECORATION: underline; CURSOR: hand; } </style> <style> .tbody1 { BACKGROUND: #ffffff; BORDER-BOTTOM: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbody2 { BACKGROUND: #FDF5E6; BORDER-BOTTOM: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-RIGHT: #FDF5E6 1px solid; BORDER-TOP: #FDF5E6 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySB { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #C1D2EE 1px solid; BORDER-RIGHT: #C1D2EE 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySL { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #316AC5 1px solid; BORDER-RIGHT: #C1D2EE 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } .tbodySR { BACKGROUND: #C1D2EE; BORDER-BOTTOM: #316AC5 1px solid; BORDER-LEFT: #C1D2EE 1px solid; BORDER-RIGHT: #316AC5 1px solid; BORDER-TOP: #316AC5 1px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; FONT-SIZE: 8pt; HEIGHT: 16px; PADDING-TOP: 0px; cursor: default; } </style> <script language='javascript'> var SPID = 0; var SCL = ''; function SelectRow(PID,CCL,Customer
Cursor.Current = Cursors.AppStarting
With IECollection
.Navigate("about:blank")
Do While .ReadyState <> SHDocVw.tagREADYSTATE.READ
Application.DoEvents()
Loop
.Document.open()
.Document.write(sHTML)
.Document.close()
End With
Cursor.Current = Cursors.Arrow
ASKER
so after the title event gets triggered once it doesnt get triggered again
With AxWebBrowser1
.Navigate("about:blank")
Do While .ReadyState <> SHDocVw.tagREADYSTATE.READ
Application.DoEvents()
Loop
.Document.open()
.Document.write("<html>Hel
.Document.close()
End With