Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: How to Save XLS worksheet to HTML via ASP


Message #1 by "Arun Kumar" <arun.kumar@m...> on Fri, 23 Feb 2001 22:55:23
Hi,

 Here is what I am trying to do. I have an Excel file with multiple 

worksheets. I need to open that file, open a particular worksheet and 

call "SaveAs" web page. All through ASP. Please if any gurus out there 

have done this and can throw a little code, it will be appreciated. Here 

is what I am trying to write:

-------------------------------

Set objExcel = Server.CreateObject("Excel.Application.9")

set xlWorkbooks = objExcel.Workbooks

Set xlWorkbook = xlWorkbooks.Open(Server.MapPath(".") & "\ExcelReport.xls")

xlWorkbook.saveAs  "C:\arun.htm", xlHtml

xlWorkbook.Close 

xlWorkbooks.Close

objExcel.Quit

Set objExcel = Nothing

---------------------

The Server.MapPath("." ) returns c:\inetpub\webroot\excel\new.

When I run this, it actually create two shortcuts is c:\ root directory:

1. "New" shortcut to the directory c:\inetpub\webroot\excel\new and

2. "ExcelReport" shortcut toc:\inetpub\webroot\excel\new\ExcelReport.xls

 

What am I doing wrong and why it does not work?

Any help is appreciated.

Thanks

Arun

  Return to Index