VBScript Sub is executed twice....
Hello,
My following code executes the VBScript sub twice. Could someone help me figure out why this happens?
Thanks.
================================================== ==============
<HEAD>
<LINK REL=StyleSheet HREF='/BPA/inc/pubstyle.css' TYPE='text/css' MEDIA=screen>
<SCRIPT LANGUAGE="VBScript">
sub Templates_OnClick()
Dim oExcel, oSheet
Dim intFieldId(50), intCnt
On Error Resume Next
Set oExcel=GetObject(,"Excel.Application")
If TypeName(oExcel) <> "Application" Then
Set oExcel=CreateObject("Excel.Application")
End If
oExcel.Visible=False
oExcel.WorkBooks.Open "c:\test.xls"
intCnt=1
For Columns=1 To 12
intFieldId(Columns)=oExcel.ActiveSheet.Cells(1,Col umns)
Next
MsgBox intFieldId(3)
oExcel.WorkBooks.Close
oExcel.Quit
Set oExcel = Nothing
End Sub
</SCRIPT>
</HEAD>
<%
Dim intMode
Dim i
intMode=Request.QueryString("Mode")
If CInt(intMode) = 10 Then
%><BODY onLoad="window.close()"><%
Else
%><BODY>
<FORM NAME="Templates" METHOD=POST ACTION="offline.asp?mode=10">
<INPUT TYPE="HIDDEN" NAME=temp Value=0>
<INPUT TYPE="SUBMIT" NAME=Templates Value="Begin">
</FORM>
<%
End If
%>
</BODY>
</HTML>
|