Delete first 5 rows

Results 1 to 2 of 2

Thread: Delete first 5 rows

  1. #1
    Join Date
    Dec 1969

    Default Delete first 5 rows

    Hello,<BR><BR>I need to delete the first 5 rows from my excel s/s from ASP page. This is how I am trying to do<BR><BR>exlpath="C:myexcel.xls"<BR>set oExcel=Server.createobject("Excel.Application")<BR > With oExcel<BR> .DisplayAlerts = False<BR> .Application.Visible = False<BR> .Workbooks.Open exlpath, , False<BR> .Sheets(1).Select<BR> exlsheet="output$"<BR> for I=1 To 4<BR> .ActiveWorkbook.Sheets(1).Rows(1).EntireRow.Delete <BR> Next<BR> <BR> .ActiveWorkbook.Save<BR> .ActiveWorkbook.Close<BR> .Application.Quit<BR> end with<BR><BR><BR>But when I run the asp page it throws the below error:<BR><BR>[color=&#039;red&#039;]&#039;myexcel.xls&#039; is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box.[/color]<BR><BR><BR>But when I check the properties it is not readonly.<BR><BR><BR>Please help<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default It's probably read-only *TO ASP*

    When you access any file (including Access databases) via ASP, you are using the "user id" of the web server, which is IUSR_xxx where xxx is you machine&#039;s name.<BR><BR>Look in the ASPFAQs (link center above) for a similar error ("can&#039;t update database") with Access and see the fix posted there.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts