Asp Codes
ActiveX
ADO
Array
Code Snippets
Components
Data Access
Date Time
Files
Graphics
HTML Formatting
Mathematics
Miscellaneous
Sessions
SQL
Strings
Techniques
XML
Asp > Components sample source codes
MkSheet Statement
MkSheet Statement example usage: <% MkSheet Server.MapPath("/file.xls") %> source code: <% Private Sub MkSheet(ByVal pathname) Dim objXls, objBook, objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FileExists( pathname ) Then Set objFSO = Nothing Err.Raise 5150, "MkSheet Statement", _ "File Already Exists! MkSheet " & _ "can only create sheets." Exit Sub End If Set objFSO = Nothing On Error Resume Next Set objXls = CreateObject("Excel.Application") If Err Then Err.Clear On Error GoTo 0 Err.Raise 5150, "MkSheet Statement", _ "Microsoft Excel Is Not Installed " & _ "On This Server!" Exit Sub End If Set objBook = objXls.Workbooks.Add objBook.SaveAs( pathname ) Set objBook = Nothing objXls.Quit Set objXls = Nothing On Error GoTo 0 End Sub %>
Privacy Policy
|
Link to Us
|
Links