Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<!--#include virtual="/GPPObuilding/includes/Dev_top_nohead.asp"-->
<!--#include virtual="/gps/includes/adovbs.inc"-->
<html>
<head>
</head>
<script LANGUAGE="VBScript">
sub cmdxl_onclick()
'Launch Excel
Dim TheForm, oValue, oName, nObjs, oDisp
Dim s, xcol, xrow, formaddr, xstart
Dim wb, app, n, Qu, headQU, nSub
'start Row = 4
xstart = 4
set TheForm = document.forms("xlout")
set app = createobject("Excel.Application")
headQU = TheForm.item("numberQuest").value ' should be 15
nSub = TheForm.item("RowCount").value/headQU ' should be 2
' Make it visible
app.Visible = true
' Add a new workbook
set wb = app.workbooks.add
' Fill array of values first...
nObjs = TheForm.length ' not used, but this is how you get the number of objects on a form
' Titles Layout as per Border Graphics Spreadsheet
app.StatusBar = "Please wait... adding headings"
wb.Activesheet.Cells(1, 1).Value = "Online survey Builder"
wb.Activesheet.Cells(1, 1).Font.size = "16"
wb.Activesheet.Cells(1, 1).Font.Bold = True
wb.Activesheet.Cells(2, 3).Value = date()
wb.Activesheet.Cells(2, 3).Font.size = "12"
wb.Activesheet.Cells(2, 3).Font.Bold = True
wb.Activesheet.Cells(2, 2).Value = "Extract Date:"
wb.Activesheet.Cells(2, 2).Font.size = "12"
wb.Activesheet.Cells(2, 2).Font.Bold = True
'Headings for spreadsheet
'wb.Activesheet.Cells(xstart, 1).Value = "Prop Ref"
'For xcol = 0 to 44 ' cols
' formaddr = Trim(Cstr(0)) & "," & Trim(Cstr(xcol))
' wb.Activesheet.Cells(xrow+xstart, xcol+1).Value = "'" & trim(left(TheForm.item(formaddr).value,250))
'next
app.StatusBar = "Please wait... formatting headings"
For i = 0 To headQU
wb.Activesheet.Cells(xstart,i + 1).Interior.ColorIndex = 3
wb.Activesheet.Cells(xstart,i + 1).Font.Bold = True
wb.Activesheet.Cells(xstart,i + 1).Font.size = 8
wb.Activesheet.Cells(xstart,i + 1).ColumnWidth = 15
wb.Activesheet.Cells(xstart,i + 1).RowHeight = 10
wb.Activesheet.Cells(xstart,i + 1).VerticalAlignment = 1
wb.Activesheet.Cells(xstart,i + 1).WrapText = True
wb.Activesheet.Cells(xstart,i + 1).Borders(3).Weight = 2
wb.Activesheet.Cells(xstart,i + 1).Borders(4).Weight = 2
wb.Activesheet.Cells(xstart,i + 1).Borders(1).Weight = 2
wb.Activesheet.Cells(xstart,i + 1).Borders(2).Weight = 2
next
qu =0 ' sets the question number
'get data
app.StatusBar = "Please wait... fetching data"
' question header
For xcol= 1 to headQU ' COLS
qu=qu+1
wb.Activesheet.Cells(xstart, xcol).Value = "'" & qu
next
For xrow = 1 to nSub ' ROWS 2
For xcol = 1 to headQU ' COLS
formaddr = Trim(Cstr(xcol)) & "," & Trim(Cstr(xrow))
wb.Activesheet.Cells(xrow+xstart+1, xcol).Value = "'" & trim(left(TheForm.item(formaddr).value,250))
next
next
'formatting
app.StatusBar = "Please wait... formatting data"
Dim strRange
strRange = "T5:T" & TheForm.item("RowCount").value + xstart
wb.Activesheet.Range(strRange).NumberFormat = "#,##0.00"
strRange = "A" & xstart + 1 & ":AS" & TheForm.item("RowCount").value + xstart
wb.Activesheet.Range(strRange).WrapText = false
wb.Activesheet.Range(strRange).MergeCells = false
wb.Activesheet.Range(strRange).HorizontalAlignment = 1
wb.Activesheet.Range(strRange).VerticalAlignment = 1
wb.Activesheet.Range(strRange).Font.Bold = False
wb.Activesheet.Range(strRange).Font.size = 8
wb.Activesheet.Range(strRange).Rows.AutoFit
strRange = "A" & xstart & ":AS" & TheForm.item("RowCount").value + xstart
wb.Activesheet.Range(strRange).Columns.AutoFit
' Give the user control of Excel
app.UserControl = true
app.StatusBar = "Job Done"
msgbox "Transfer to Excel completed.",vbinformation,"Online survey Builder"
end sub
</script>
<body onload="cmdxl_onclick();">
<form name="xlout">
<%
'on error resume next
Dim objRec
Dim objRec1
Dim objRec2
Dim SQLcount
Dim SQLQuery
Dim StrText
Dim I
Dim iRow
Dim curprop
'Set ObjRec = Server.CreateObject("ADODB.Recordset")
Response.write "<TABLE border=0 width='100%'>"
'FM's
Response.Write "<TR>"
Response.Write "<TD width=175><Font face='arial' size='2'></TD>"
if Request.QueryString("sid")<>"" or Request.QueryString("qid")<>"" then
Response.Write "<hr>"
'create report
Set objRec = Server.CreateObject("ADODB.Recordset")
SQLQuery = "SELECT GPS.TBLRESULTS.ANSWER"
SQLQuery = SQLQuery & " FROM GPS.TBLRESULTS"
SQLQuery = SQLQuery & " WHERE GPS.TBLRESULTS.QUESTCODE ='" & Request.querystring("qid") & "'"
SQLQuery = SQLQuery & " And GPS.TBLRESULTS.SURVEY_ID ='" & Request.querystring("sid") & "'"
SQLQuery = SQLQuery & " ORDER BY SUBMIT_ID, SUB_DATE, IP, QUESTION_NO"
'Response.Write SQLQuery
objRec.open SQLQuery, conn, adOpenForwardOnly, adLockReadOnly
Set objRec1 = Server.CreateObject("ADODB.Recordset")
SQLcount = "SELECT Count(RESULTS_ID) AS reccount FROM GPS.TBLRESULTS"
SQLcount = SQLcount & " WHERE GPS.TBLRESULTS.QUESTCODE ='" & Request.querystring("qid") & "'"
SQLcount = SQLcount & " And GPS.TBLRESULTS.SURVEY_ID ='" & Request.querystring("sid") & "'"
SQLcount = SQLcount & " ORDER BY SUBMIT_ID, SUB_DATE, IP, QUESTION_NO"
objRec1.open SQLcount, conn, adOpenForwardOnly, adLockReadOnly
Set objRec2 = Server.CreateObject("ADODB.Recordset")
SQLQuery = "SELECT GPS.TBLSETUP.NUMBEROFQUEST"
SQLQuery = SQLQuery & " FROM GPS.TBLSETUP"
SQLQuery = SQLQuery & " WHERE GPS.TBLSETUP.QUESTCODE ='" & Request.querystring("qid") & "'"
SQLQuery = SQLQuery & " And GPS.TBLSETUP.SURVEY_ID ='" & Request.querystring("sid") & "'"
objRec2.open SQLQuery, conn, adOpenForwardOnly, adLockReadOnly
%>
<!--<input type="Button" Value="View in Excel" Name="btnxl" onclick="cmdxl_onclick();">-->
<p>Please wait exporting data to Excel.......</p>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<%
iRow=0
'for I = 0 to ObjRec.Fields.count - 1
'Response.Write "<td>" & Replace(ObjRec.fields(I).Name,"_"," ") & "<INPUT type='hidden' name='" & irow & "," & i & "' value='" & Replace(ObjRec.fields(I).Name,"_"," ") & "'</TD>"
'next%>
</tr>
<%
Dim iSubmit
dim Col
iSubmit = objRec2("NUMBEROFQUEST")
iRow = 0
col =1
Response.Write "<TR>"
If Not objRec.EOF Then
Do Until objRec.EOF
iRow = iRow + 1
if iRow = iSubmit+1 then
col =col+1
irow =irow - iSubmit
Response.Write "</TR><TR>"
End if
For i = 0 To objRec.fields.Count-1
Response.Write "<TD><font face=arial size=1>"
Response.Write "<INPUT name='" & irow & "," & col & "' value='" & ObjRec.fields(I).value & "'>"
Response.Write "</TD>"
Next
objRec.MoveNext
Loop
Response.Write "</TR>"
End If
%><input id="RowCount" type="hidden" name="RowCount" value="<%=objRec1("reccount")%>"> <!-- use SQL count to get value-->
<input id="numberQuest" type="hidden" name="numberQuest" value="<%=objRec2("NUMBEROFQUEST")%>"><!-- get from tblesetup-->
</table><%
objRec.Close
set objRec = nothing
objRec1.Close
set objRec1 = nothing
objRec2.Close
set objRec2 = nothing
End if
%><a href="javascript:window.close();">Close Window</a>
</form>
<!--#include virtual="/GPPObuilding/includes/bottom.asp"-->
<p><!--webbot bot="PurpleText" PREVIEW="DO_NOT_REMOVE_END" --></p>
<p><small>Last
updated: <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d/%m/%y" startspan -->17/03/05<!--webbot bot="Timestamp" endspan i-checksum="12907" --></small></td>
<td width="29%" valign="top" class="rightcolumn">
</body>
</html>