the form fields
itemCount = itemCount + 1 ''using For..Next loop
%>
<INPUT TYPE="hidden" NAME="<%=Item%>" VALUE="<%=Request(Item)%>">
<% Next %>
<INPUT TYPE="hidden" NAME="numbRows" VALUE="<%=intRowCount%>">
<INPUT TYPE="hidden" NAME="fieldCount" VALUE="<%=itemCount%>">
</FORM>
</BODY>
</HTML>
We create an instance of the Word Document object, using the sample co
de immediately below. Note that in Internet Explorer 4+ this will fail
unless the browser security is set to Low, or Custom with the appropr
iate setting to run programs.
<%
Set objWordDoc = CreateObject("Word.Document")
ObjWordDoc.Application.Documents.Add theTemplate, False
ObjWordDoc.Application.Visible=True
%>
We re-dimension our array so that it is the same size as the number of
rows that are contained in the Web page''s form. In this case, we set
the Y-axis to a constant value of four because that is the number of c
olumns we need in the output document. The X-axis contains the number
of received rows from the form.
<%
Redim Preserve theArray(4,intTableRows)
%>
Now we are ready to examine all of the form rows. We do this by loopin
g through all the input Web page form fields to collect each form fiel
d name and corresponding value. We test each to determine which array
element to put it into, and then we put it there. The SELECT CASE stat
ement in the code sample below is important. It is where we determine
in which column the form field belongs. We used hard coded CASE option
s here for expediency.
<%
For intCount = 0 to frmData.fieldCount.value
strOkay = "Y"
strSearch = frmData.elements(intCount).name ''load the field name
strValue = frmData.elements(intCount).value ''load the field value
strPosition = Instr(1,strSearch,"_") ''get pos val of "_"
intStringLen=strPosition-1
If intStrLen > 0 Then
strLeft = Left(strSearch,intStringLen)
strRight = Right(strSearch,(Len(strSearch)-Len(strLeft)-1))
Select Case strLeft
Case "SKU" intArrayY=0
Case "description" intArrayY=1
Case "p