Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 28th, 2011, 03:23 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating New Excel Worksheets With Classic ASP

I'm trying to build an application that creates an Excel template to help standardize documents. I created a form that collects the data from the user and sends it to an asp page which created the spreadsheet and formats the submitted data.

The initial page is created fine but How can I add new worksheets to the XLS file?

My code is here:




<%


OPTION EXPLICIT



' Waits until all the asp is done before dumping the text to the browser
response.buffer = true


'Receiving values from Form, assign the values entered to variables
'Set a new variable for each new form field added

DIM newclient
newclient=Request.Form("newclienttxt") 'Define Variable For New Client Acronym

DIM tech
tech=Request.Form("techreptxt") 'Define Variable For Tech Support Field

DIM techph
techph=Request.Form("techphone") 'Define Variable For Tech Support Phone

DIM tsbk
tsbk=Request.Form("addrep1") 'Define Variable For Additional Tech Rep

DIM bkrepph
bkrepph=Request.Form("bkrepphone") 'Define Variable For Additional Tech Phone

Dim sqetxt
sqetxt=Request.Form("sqetxt")

DIM sqeph
sqeph=Request.Form("sqephone") 'Define Variable For SQE Phone

DIM dba
dba=Request.Form("dbatxt") 'Define Variable For DBA

DIM dbaph
dbaph=Request.Form("dbaphone") 'Define Variable For DBA Phone

DIM sitecontact
sitecontact=Request.Form("sitecontactstxt") 'Define Variable For Site Contact

DIM sitecontactph
sitecontactph=Request.Form("sitecontactphone")'Def ine Variable For Site Contact Phone

DIM siteprimaryemail
siteprimaryemail=Request.Form("siteprimaryemail") ' Define Variable For Primary Site Email Address

DIM alineo
alineo=Request.Form("alineo") 'Define Variable For Software

Dim cpweb
cpweb=Request.Form("cpweb") 'Define variable for CPWeb drop down menu

Dim iExchange
iExchange=Request.Form("iExchange") 'Define variable for iEchange drop down menu

Dim fso 'Define filesystem object




' Tells the browser to open Excel
Response.ContentType = "application/vnd.ms-excel"






%>

<html>
<head>
<title></title>

<style type="text/css">

.title {
FONT-SIZE: 15pt; COLOR: blue; FONT-FAMILY: arial; BACKGROUND-COLOR: #dddddd
}
.txt {
FONT-SIZE: 25pt; COLOR: black; FONT-FAMILY: tahoma
}

TD.maintxt {
FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: arial narrow
}

TD.subhead {
FONT-SIZE: 15pt; COLOR: black; FONT-FAMILY: arial narrow; font-weight:bold; BACKGROUND-COLOR: #dddddd;

}


</style>
</head>



<body>


<!--Main table with submitted data --//>

<table width="550" align="center" border="0">

<tr>
<td class="title" align="middle" colspan="2"><%response.Write(newclient)%> Client Document</td>
</tr>

<tr>
<td>&nbsp;</td>


<tr>
<td class="subhead" width="246">MEDecision Contact Information</td>

<td width="290"></td>
</tr>

<tr>
<td class="maintxt" width="248">Tech Support Rep: <%response.Write(tech)%></td>

<td class="maintxt" width="290">Phone: <%response.write(techph)%></td>
</tr>

<tr>
<td class="maintxt">TS Backup: <%Response.Write(tsbk)%></td>
<td class="maintxt">Phone: <%Response.Write(bkrepph)%> </td>

</tr>

<tr>
<td class="maintxt">Database Admin: <%Response.Write(dba)%></td>
<td class="maintxt">Phone:<%response.write(dbaph)%></td>

<tr>

<td class="maintxt">SQE: <%Response.Write(sqetxt)%></td>
<td class="maintxt">Phone: <%Response.Write(sqeph)%></td>


</tr>
</table>

<BR>
<BR>

<table width="550" align="center" border="1">

<tr>
<td class="subhead">Site Contacts:</td>

<tr>

<td class="maintxt">Primary Contact: <%Response.Write(sitecontact)%></td>

<td class="maintxt">Phone:<%Response.Write(sitecontact ph)%></td>
</tr>

<tr>
<td class="maintxt">E-Mail:<%Response.Write(siteprimaryemail)%>

<tr>
<td class="maintxt"></td>

<td></td>
</tr>

<tr>
<td class="subhead">Software Environemnt:</td>

<tr>


<td class="maintxt"><%Response.Write(alineo)%></td>

<tr>


<td class="maintxt"><%Response.Write(cpweb)%></td>

<tr>

<td class="maintxt"><%Response.Write(iExchange)%>
</tr>

</table>










<%


<!-- This code is for testing which variables are being passed from the form. Take out when in PRODUCTION //-->

' Check to see if any querystring varibles exist


if len (request.servervariables("query_string")) >1 then

%>




<b>Variables passed via QueryString</b><br>
<!-- The following was passed via a form with a method equal to get, a hyperlink, or
a form action with written varibles -->


<%

Dim variable_name
Dim variable_value

'Loop to find each querystring variable name and varible value

for each variable_name in request.querystring
variable_value=request.querystring(variable_name)

'If there is a querystring variable name and value inputted then write it also
response.write variable_name &" = "
response.write variable_value &"<br>" &chr(13)
next

' end for next loop for all querystrings
end if

' end check for querstring values

' Check to see if any form varibles exist
if len(request.form) > 0 then

%>



<p>

<b>Variables passed via Post</b><br>



<!-- The following was passed via a form with a method equal to post -->


<%
'Loop to find each variable name and varible value


for each variable_name in request.form
variable_value=request.form(variable_name)

'If there is a variable name and value inputted then write it also
response.write variable_name &" = "
response.write variable_value &" <br>" &chr(13)
next ' end for next loop for all
end if ' end check for form values
%>







</body>
</html>
 
Old September 28th, 2011, 08:04 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

A good question. Im not so sure you can call and write to a new sheet using this method. You are afterall just showing an HTML page inside excel, its not a proper xls file.

I think you are asking a bit much of 'out of the box classic ASP' and you will need a third party component such as this:

http://www.4guysfromrolla.com/webtech/051502-1.shtml

That said, if you find a way please post it.........Good luck
__________________
Wind is your friend
Matt
 
Old September 29th, 2011, 10:07 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I saw that before but had some issues with it. I've googled to no end and I don't think I will find any easy FREE option for this.

Thanks for your reply!
 
Old September 29th, 2011, 06:27 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

As I said im very sure there are no 'out of the box' solutions for you. Surely you can change your plan/workflow to suit, otherwise you may have to overcome what ever your issues are with the component.

Good luck and sorry I could not assist...
__________________
Wind is your friend
Matt




Similar Threads
Thread Thread Starter Forum Replies Last Post
Create an Excel Spread with multiple worksheets hewstone999 Access VBA 1 March 7th, 2008 08:21 AM
Excel Worksheets brawny4 Excel VBA 2 December 29th, 2007 04:57 AM
Splitting Excel file into Multiple Worksheets tvschalapathirao Dreamweaver (all versions) 3 May 16th, 2005 02:16 AM
Creating two worksheets from 2 HTML pages Greg Griffiths Excel VBA 0 February 9th, 2004 05:31 PM
Links to MS Excel Worksheets Dudester Classic ASP Basics 0 June 7th, 2003 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.