by Armand Datema
Here is a new tutorial on how to write to an Excelsheet using ASP. The result is nothing serious, but
it shows the potential :)
First we set the type of script
<%@ LANGUAGE="VBSCRIPT"
%>
Make the object, and set the object to
an Excelsheet
Dim ExcelFace
Set
ExcelFace = CreateObject("Excel.Sheet")
Now lets write the rest of the
script, see the comments
' show or dont show Excel
to 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
%>
Now lets complete the HTML
tags.
<HTML>
<HEAD>
<TITLE>Excelface</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
This completes yer ASP page,
look below for the complete code of
excelface.asp
<%@ LANGUAGE="VBSCRIPT" %>
<%
'
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
%>
<HTML>
<HEAD>
<TITLE>Excelface</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
Download Code