Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete Rows
Message
From
10/06/2003 09:30:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/06/2003 09:12:10
Luis Navas
Independent Consultant
Auckland, New Zealand
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00798119
Message ID:
00798335
Views:
29
Sounds like David is not online.
Remove parentheses after Rows.
for each loRow in oSheet.Rows
   if ( loRow.Height = 3 )
      loRow.Delete()
   endif
endfor
Cetin


>Thanks a lot for your input. I'm getting a syntax error in the FOR EACH loop
>I think that is for the assigment of oRow. Please can you help a little bit more.
>Thanks
>Luis
>
>>Luis,
>>
>>Testing this from the command window:
>>
>>
oExcel = createobject("excel.application" )
>>oExcel.Visible = .t.
>>oExcel.Workbooks.Add() && you should use a call to Open() to open an existing file
>>oSheet = oExcel.ActiveSheet
>>oRow = oSheet.Rows(1)
>>? oRow.Height && prints 12.75 for me
>>oRow.Delete() && deletes the first row
>>
>>So this loop ought to work:
>>
>>
for each loRow in oSheet.Rows()
>>   if ( loRow.Height = 3 )
>>      loRow.Delete()
>>   endif
>>endfor
>>
>>Realize though that a spreadsheet has a lot of rows so it may take a long time to process unless you use something else to limit the number of rows that actually get processed.
>>
>>>Hi. I need to delete a series of rows in an excel sheet. The rows i need to delete are those that has a heigth< 3. So i will like to know how can i make it with a for loop. Maybe someone can give me an example of how to delete those rows without knowing the number. I wan't to make something like this:
>>>
>>>FOR EACH row
>>> IF row.height < 3
>>> row.delete
>>> ENDIF
>>>ENDFOR
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform