Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

-Read HTML variables into VB - help

Status
Not open for further replies.

lmcate2929

Technical User
Oct 27, 2009
4
US
this is the HTML that I received and I want to extract the values of the two inputs TXTID AND QMID?

<html>
<head>
<title>QM Push</title>
<script language=javascript>
var objShell = new ActiveXObject("WScript.Shell");
function run(){

RESULT.innerHTML='<FONT Color=Green>Sending data to CallTrak window...</FONT>';
objShell.AppActivate("CallTrak");
window.setTimeout("javascript: objShell.SendKeys(\'"+txtID.value+"\');", 200);
window.setTimeout("javascript: objShell.SendKeys(\'{TAB}"+txtVIT.value+"\');", 200);
window.setTimeout("javascript: objShell.SendKeys(\'{TAB}~\');", 200);
window.clipboardData.setData('Text',txtID.value);
RESULT.innerHTML='<FONT Color=Red>Sent data to CallTrak window (QM ID `'+txtID.value+'` has been copied to the clipboard)...</FONT>';
}
</script>
</head>
<body>
<h2>Push To CallTrak Example</h2>
<p><b>QM ID:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id=txtID name=txtID tabIndex=1 value='Test QM ID'><br>
<b>VIT Code:</b> <input id=txtVIT name=txtVIT tabIndex=2 value='Test VIT Code'>
</p>
<input type="button" value="Push Data" style="CURSOR: hand" onclick="run();" ID=Button1>&nbsp;<label id="RESULT"></label>
</body>
 
That's the code, it isn't going to have any values outputted to it. You are going to have to manipulate the web page using the DHTML object model, a subject far to complex to get into on a forum thread. Just google up "DHTML VBA" and you'll get a ton of hits on msdn with example code, etc. Essentially you load the page as a DHTML object, and then using, IIRC, the "innertext" and "outertext" properties you can get at the actual values present on the page. You might even be able to use the variables themselves from with the DHTML object to get at the values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top