Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete Rows
Message
 
 
À
09/06/2003 17:19:11
Luis Navas
Independent Consultant
Auckland, Nouvelle Zélande
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00798119
Message ID:
00798183
Vues:
31
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
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform