cowhunter
January 16th, 2002, 12:36 PM
All I want to do is open an existing Excel file in ASP. Then Add some text into a few of the cells and close it again. Any Ideas? Thanks for any help.
|
Click to See Complete Forum and Search --> : Editing Excel with ASP cowhunter January 16th, 2002, 12:36 PM All I want to do is open an existing Excel file in ASP. Then Add some text into a few of the cells and close it again. Any Ideas? Thanks for any help. rajeshr6 February 6th, 2002, 01:49 AM Hi, I am not sure if u have got the solution by now. anyway the way u do is to use Excel.application object. The hirearchy is Application->Workbook object->Worksheet Object-> Range Object. Am giving an example. hope it helps Dim wrkbook As Excel.Workbook Dim sheet As Excel.Sheets Dim wrksheet As Excel.Worksheet Dim InpRange As Object Dim OutRange As Excel.Range Dim xlapp As New Excel.Application () //create a new excel app object wrkbook = xlapp.Workbooks.Open ("http://localhost/testbook.xls", 0, True, 5, "", "", True, Excel.XlPlatform.xlWindows, "\t", True, False, 0, True) //open the workbook sheet = wrkbook.Sheets() wrksheet = sheet.Item(2) //select the worksheet OutRange = wrksheet.Range ("A2", "A20") //select the cell outrange.value2 = "test" //change the value in the cell wrkbook.saved = true xlapp.quit() //quit the excel object xlapp = nothing Zeroorder codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |