+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Excel and Email

  1. #1
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    Excel and Email

    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. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    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, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    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. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Quote Originally Posted by Chrissy View Post
    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.
    If the file is generated by ASP code, then you can use the FileSystemObject to save it to the web server: ASP FileSystem Object
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  5. #5
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    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")%>&nbsp;<%=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. #6
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    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. #7
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    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)
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  8. #8
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    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
    
    specially these 2 lines


    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. #9
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    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.
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  10. #10
    Barn Newbie Chrissy is an unknown quantity at this point Chrissy's Avatar
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    2

    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.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Email Tracking Code
    By dr_rock in forum ASP Code Samples
    Replies: 0
    Last Post: January 20th, 2009, 10:54 PM
  2. Sending Email with ASP and CDOSYS
    By jmurrayhead in forum ASP Code Samples
    Replies: 1
    Last Post: November 13th, 2008, 09:26 AM
  3. help with email validation
    By Rebelle in forum JavaScript Programming
    Replies: 13
    Last Post: August 21st, 2008, 10:57 AM
  4. Using dll to send email - Multithreading
    By sync_or_swim in forum ASP Development
    Replies: 1
    Last Post: August 4th, 2008, 10:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO