Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete Rows
Message
From
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:
00798321
Views:
33
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
I never forget a face, but in your case I will make an exception :-)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform