I am attempting to build a VBA 6.0 userform (just below) to submit the criteria on a javascript form/webpage (way below). Is this possible? Any suggestions?
Here's my code:
**************************
**********
**********
********
Private Sub cmdQuery_Click()
'WB.Navigate "
http://acmeap01:7001/eds/power_query.jsp?type=Forward"
Do Until WB.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
WB.Document.Forms(0).prc_i
d.Value = ListBox1.Value
WB.Document.Forms(0).effda
te_f.Value
= DTPicker1.Value
WB.Document.Forms(0).effda
te_t.Value
= DTPicker2.Value
WB.Document.Forms(0).start
period.Val
ue = DTPicker3.Value
WB.Document.Forms(0).toper
iod.Value = DTPicker4.Value
WB.Document.Forms(0).submi
t
Dim myPath As String
'***Where to store the temporary file
myPath = "C:\Documents and Settings\RMRq\Desktop\myTa
ble.xls"
'Save only the table from the WB using the DOM
Open myPath For Output As #1
Print #1, WB.Document.getElementsByT
agName("Ta
ble").Item
(4).outerH
TML
Close #1
'Open it in Excel
Dim oExcelApp As New Excel.Application
Set oExcelApp = CreateObject("excel.applic
ation")
oExcelApp.Visible = True
oExcelApp.Workbooks.Open (myPath)
End Sub
Here's the javascript webpage:
**************************
**********
**********
********
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset
=ISO-8859-
1">
<title>eds Reports</title>
<link rel="Stylesheet" href="eds.css" type="text/css">
<SCRIPT LANGUAGE="JavaScript" src='/eds/report_js.js'>
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,l
ocation=ye
s,scrollba
rs=yes,res
izable=yes
");
}
</SCRIPT>
</head>
<SCRIPT LANGUAGE="JavaScript">
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,l
ocation=ye
s,scrollba
rs=yes,res
izable=yes
");
}
function openWin(url, name) {
var height = 300;
var width = screen.availWidth - 150;
var str = "height=" + height + ",innerHeight=" + height;
str += ",width=" + width + ",innerWidth=" + width;
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
str += ",resizable,scrollbars,men
ubar";
window.open(url, name, str);
windowIsOpen = "true";
}
</SCRIPT>
<BR>
<BR>
<CENTER><B><FONT size="5" color="#99CCFF">Forward Power/Other Selection Criteria </font></b></CENTER>
<form method="get/POST" action="power_query_result
.jsp" name="power">
<table bgcolor="#99CCFF" width="700" align="center" cellpadding=5 cellspacing=0 border=0>
<tr>
<td>
<TABLE width="700" bgcolor="#99CCFF" cellpadding=5 cellspacing=1 border=0>
<font size="1">
<TR bgcolor="#FFFFFF">
<td><b>Index :</b></td>
<td colspan="4"><select name="prc_id" size="10" multiple>
<option value=1038>1038-COB Flat</option>
<option value=1014>1014-COB OffPeak</option>
<option value=1013>1013-COB OnPeak</option>
<option value=1040>1040-Four Corners Flat</option>
<option value=1041>1041-Four Corners OffPeak</option>
<option value=1039>1039-Four Corners OnPeak</option>
<option value=1042>1042-Mead Flat</option>
<option value=1001>1001-Mead OffPeak</option>
<option value=1000>1000-Mead OnPeak</option>
<option value=1087>1087-Mid-C Flat</option>
<option value=1044>1044-Mid-C OffPeak</option>
<option value=1043>1043-Mid-C OnPeak</option>
<option value=1045>1045-NP15 Flat</option>
<option value=1035>1035-NP15 Hourly Forward Price</option>
<option value=1012>1012-NP15 OffPeak</option>
<option value=1011>1011-NP15 OnPeak</option>
<option value=1007>1007-PV Flat</option>
<option value=1010>1010-PV OffPeak</option>
<option value=1009>1009-PV OnPeak</option>
<option value=1046>1046-SP15 Flat</option>
<option value=1003>1003-SP15 OffPeak</option>
<option value=1002>1002-SP15 OnPeak</option>
<option value=1047>1047-ZP26 Flat</option>
<option value=1028>1028-ZP26 OffPeak</option>
<option value=1027>1027-ZP26 OnPeak</option>
</select></td>
</tr>
<tr bgcolor="#FFFFFF" >
<td><b>Effective Date:</b></td>
<td width="40"><b>From</b></td
><td><inpu
t type="text" name="effdate_f" value="07/18/2004" size=8 maxlength="10" onFocus="javascript:vDateT
ype='1'" onKeyUp="DateFormat(this,t
his.value,
event,fals
e,'1',0)" onBlur="DateFormat(this,th
is.value,e
vent,true,
'1',1)"></
td>
<td><b>To</b></td><td><inp
ut type="text" name="effdate_t" value="07/18/2004" size=8 maxlength="10" onFocus="javascript:vDateT
ype='1'" onKeyUp="DateFormat(this,t
his.value,
event,fals
e,'1',0)" onBlur="DateFormat(this,th
is.value,e
vent,true,
'1',1)"></
td>
<tr bgcolor="#FFFFFF">
<td><b>Period Date:</b></td>
<td><b>From</b></td><td><i
nput type="text" name="startperiod" value="" size=8 maxlength="10" onFocus="javascript:vDateT
ype='1'" onKeyUp="DateFormat(this,t
his.value,
event,fals
e,'1',0)" onBlur="DateFormat(this,th
is.value,e
vent,true,
'1',1)"></
td>
<td><b>To</b></td><td><inp
ut type="text" name="toperiod" value="" size=8 maxlength="10" onFocus="javascript:vDateT
ype='1'" onKeyUp="DateFormat(this,t
his.value,
event,fals
e,'1',0)" onBlur="DateFormat(this,th
is.value,e
vent,true,
'1',1)"></
td>
</tr>
<tr bgcolor="#FFFFFF">
<td><b>Price Type: </b></td>
<td colspan="3"><input type="radio" name="prc_cde" value="Settled" disabled>Settled <BR><input type="radio" name="prc_cde" value="Forward" checked>Forward</td>
<td><b>Exclude Weekend and Holidays? </b>
<input type='checkbox' name='weekendflag' 'value='Y' checked></td>
</tr>
<tr bgcolor="#FFFFFF"><td colspan="5"><input type="submit" value="Retrieve" onClick="javascript:return
ValidateForm(window.docume
nt.power.e
ffdate_f,w
indow.docu
ment.power
.effdate_t
,window.do
cument.pow
er.startpe
riod,windo
w.document
.power.top
eriod,1)">
</td></tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>