<%
Set xlApp = Server. CreateObject ("Excel. Application ")
XlApp. Visible = false
'Disable ServerExcelWindow.
Set myWorkbook = xlApp. Workbooks. Add
'CreateWorksheet.
Set myWorksheet = myWorkbook. Worksheets (1)
MyWorksheet. Range ("A1"). Value ='Brilliant spring breeze address book'
MyWorksheet. Range ("A1"). Font. Size = 12
MyWorksheet. Range ("A1"). Font. Bold = true
MyWorksheet. Range ("A2"). Value ='Name'
MyWorksheet. Range ("B2"). Value ='Address'
MyWorksheet. Range ("C2"). Value ='Phone number'
MyWorksheet. Range ("D2"). Value ='Mobile phone'
'Above7Create a header for a row.
MyWorksheet. Range ("A2: D2"). Font. Bold = true
StrFileName = Session. SessionID & ". xls"
'Ensure the file name is unique.
StrAppPath = Request. ServerVariables ("PATH_trANSLATED ")
StrAppPath = Left (strAppPath, limit Rev (strAppPath ,"\"))
StrFullPath = strAppPath & strFileName
MyWorkbook. SaveAs (strFullPath)
'Save files.
MyWorkbook. Close
'CloseExcel.
XlApp. Quit
Set myWorksheet = Nothing
Set myWorkbook = Nothing
Set myxlApp = Nothing
Response. Redirect strFileName
' Write ASP Page , In the browser .
%>
[1]