* Range object is quite flexible * .range('15:25') refers to rows 15-25, .range('A:D') refers to columns A-D * .range('A1') refers to single cell A1, .range('B5:D10') refers to a * rectangular area * .range('B5:D10, A1, 20:30, F:J') refers to multiple ranges - not safe nStartRow = 15 nRowsToDelete = 10 lcRange = trans(nStartRow)+':'+trans(nStartRow+nRowsTodelete) && '15:25' lcExportFile=GETFILE() oExcel = CREATEOBJECT([Excel.Application]) WITH oExcel *!* Open the workbook .Workbooks.Open(lcExportFile) with .ActiveWorkBook.ActiveSheet && Not mandatory but I suggest .Range(lcRange).Rows.Delete() && Delete the rows .Range("A1").Activate endwith ENDWITHCetin
lcExportFile=GETFILE() >oExcel = CREATEOBJECT([Excel.Application]) >WITH oExcel > *!* Open the workbook > .Workbooks.Open(lcExportFile) > .Rows.Delete() && Delete the rows > .Application.Goto(.Worksheets("Sheet1").Range("A1"),.T.) >ENDWITH>
>>>oExcel = CREATEOBJECT([Excel.Application]) >>>WITH oExcel >>> .Workbooks.Open(GETFILE()) >>> ?.Worksheets("Sheet1").UsedRange.Rows.Count >>>* or >>> ?.ActiveSheet.UsedRange.Rows.Count >>> .Workbooks.Close() >>>ENDWITH >>>oExcel=.F.>>>
>>#Define xlA1 1 >>#Define xlLastCell 11 >> >>lcXLS = Sys(5)+Curdir()+'customer.xls' >>oExcel = Createobject('Excel.application') >>oExcel.Workbooks.Open(lcXLS) >>With oExcel.Activeworkbook.ActiveSheet >> lcLastCell = .Range("A1").SpecialCells(xlLastCell).Address(.F.,.F.,xlA1) >> ? 'Last Cell',lcLastCell >> With .UsedRange >> ? 'Used Range Address',.Address(.F.,.F.,xlA1) >> ? 'Used Range Rows',.Rows.Count, 'Cols', .Columns.Count >> Endwith >> lcFirstUnusedRowCol = "A"+; >> Transform(Int(Val(Chrtran(; >> lcLastCell,Chrtran(lcLastCell,'0123456789',''),''))+1)) >> ? 'First Column at First unused row',lcFirstUnusedRowCol >> .Range(lcFirstUnusedRowCol).Activate >>Endwith >>oExcel.Visible = .T. >>Cetin