This is a discussion on Excel and Email within the ASP Development forums, part of the Programming & Scripting category; Hello, I have professors you host extra traning classes and then students sign up for it. I am creating a ...
| |||||||
|
#1
| |||
| |||
| Hello, I have professors you host extra traning classes and then students sign up for it. I am creating a web based section for the admin. So say for example a professor has a ASP.net class and he gets 4 students signed for it and the deadline for registration is over. The admin will log into his admin section see the professors name and click on the link which says Email. When he does that a email should be sent to the Professor with the names of the student who signed for his class. What I have done till now is get the data in excel(created a asp page and then open up excel in it). But I dont know how to save it at a specified location and then sent the email via Jmail. Any thoughts on how to proceed with it. Thanks chrissy |
|
#2
| ||||
| ||||
| So you're trying to send an Excel document as an attachment in an email? Is the Excel file already located on the web server? Here's a sample using JMail: 15 Seconds : Code Samples : Send Mail with Jmail
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#3
| |||
| |||
| I have created a asp page where I have it where it opens in excel. I need to know how to save that excel that I created in ASP page on the server. |
|
#4
| ||||
| ||||
| Quote:
|
|
#5
| |||
| |||
| This is the code I have till now Code: <%
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;filename=members.xls"
idnumber=Trim(Request.querystring("id"))
Set rsproducts = Server.CreateObject("ADODB.Recordset")
strproducts="select * from Registration where Id=" & idnumber & "'"
rsproducts.Open strproducts, Conn
%>
<head>
<title>Members</title>
</head>
<body style="margin: 0px 0px 0px 20px;">
<h2>Registered Users</h2>
<%
If rsproducts.eof then
Response.write "No Members registered"
else
%>
<table width="650" title="Registered Members">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Phone</th>
<th>Country</th>
<th>Email</th>
</th>
</tr>
<tbody>
<%
Do while not rsproducts.eof
%>
<tr>
<td><%=rsproducts("First_Name")%> <%=rsproducts("Last_Name")%></td>
<td><%=rsproducts("Address")%></td>
<td><%=rsproducts("City")%></td>
<td><%=rsproducts("State")%></td>
<td><%=rsproducts("Zip")%></td>
<td><%=rsproducts("Phone")%></td>
<td><%=rsproducts("Country")%></td>
<td><%=rsproducts("Email")%></td>
<%
rsproducts.movenext
Loop
rsproducts.close
Set rsproducts=Nothing
%>
</thead>
</table>
<%
End if
%>
</div>
</div>
</body>
</html>
|
|
#6
| |||
| |||
| So I need to know how to save the above excel file on the server and then take that path of the file and use it to sent the email. |
|
#7
| ||||
| ||||
| The code you posted will only generate an Excel document from the HTML on the page through the browser. It won't allow you to save it on the web server. You can look into using Office Web Components (OWC). See the following: http://tutorial.jcwcn.com/Web-Design...6-30/1831.html 4GuysFromRolla.com - Creating Excel Spreadsheets with Office Web Components (OWC) |
|
#8
| |||
| |||
| So I was looking at these lines of code Code: Class ExcelGen
Private objSpreadsheet
Private iColOffset
Private iRowOffset
Sub Class_Initialize()
Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")
iRowOffset = 2
iColOffset = 2
End Sub
Sub Class_Terminate()
Set objSpreadsheet = Nothing 'Clean up
End Sub
...
End Class
iRowOffset = 2 iColOffset = 2 where it says how many cols and how many rows the cols will be 12 but the rows I dont know as how many students sign will never be known can u guide me on this one |
|
#9
| ||||
| ||||
| That's just to initialize everything. If you review the code further down, there are property Let constructs that allow you to change the offsets. Just be sure to actually read the content and not just the code so you understand what it's doing. Further towards the bottom is a sample on how to use the code in an ASP page. |
|
#10
| |||
| |||
| Ok I get you now since I have read the whole article How can i fix the problem of saving as it will always save the file with same name. Because currently I have 4 professors who have classes set up and If I sent the excel sheet to one person the same will be sent to other 3 also. He doesnt tell me at the bottom of the page how he can fix the problem . Can i create a file name by the recordset Id and date it was created in the SaveWorksheet function. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Email Tracking Code | dr_rock | ASP Code Samples | 0 | January 20th, 2009 10:54 PM |
| Sending Email with ASP and CDOSYS | jmurrayhead | ASP Code Samples | 1 | November 13th, 2008 09:26 AM |
| help with email validation | Rebelle | JavaScript Programming | 13 | August 21st, 2008 10:57 AM |
| [Email] Using dll to send email - Multithreading | sync_or_swim | ASP Development | 1 | August 4th, 2008 10:15 AM |