sloppycode.net
Writing to Excel in ASP
Writing to an Excel spreadheet in ASP
Home
›
Code snippets
›
ASP
›
Writing to Excel in ASP
An example of how to write to an Excel spreadsheet, using ASP, assuming you have Microsoft Office installed. The example was borrowed from a newsgroup posting and kept here for reference.
<% ' Create Object Dim ExcelFace Set ExcelFace = CreateObject("Excel.Sheet") ' show or dont show excelto user, TRUE or FALSE ExcelFace.Application.Visible = True ' Create the yellow face ExcelFace.ActiveSheet.Range("F3:K25").Interior.ColorIndex = 6 ' Create both the blue eyes ExcelFace.ActiveSheet.Range("G6:G10").Interior.ColorIndex = 5 ExcelFace.ActiveSheet.Range("J6:J10").Interior.ColorIndex = 5 ' Create a purple nose ExcelFace.ActiveSheet.Range("H13:I18").Interior.ColorIndex = 29 ' create a red mouth ExcelFace.ActiveSheet.Range("G21:J24").Interior.ColorIndex = 3 ' Write the text ExcelFace.ActiveSheet.Cells(1,1).Value = "Now isnt this fun :) " ' Save the the excelsheet to excelface ExcelFace.SaveAs "c:\excelface.xls" ' Close Excel with the Quit method on the Application object. ExcelFace.Application.Quit ' Release the object variable. Set ExcelFace = Nothing %>
{Name}
Says:
{Date}
{Text}
› Home
› C#
› Snippets
› Articles
› Tools
› Taglines
› ASP
› Dictionary Object
› FSO
› Unix cheat sheet
› Gaming
› CSS
› Yak
› Umbraco
› About
› Contact
› Privacy
› Projects
› Search
› Sitemap
Buy on Amazon
Buy on Amazon
Buy on Amazon
Buy on Amazon