Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting n first rows from Excel
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Deleting n first rows from Excel
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01127452
Message ID:
01127452
Vues:
72
Hi everybody,

My former colleague wrote a program to create a DBF from Excel. I'm trying to add a new parameter to this program to start from particular row in the Excel sheet.

Here is what I'm trying to do in the beginning of his code to let the rest of the logic flow (needless to mention that I've changed most of his variables to more descriptive names).
*-- Select individual sheet from opened XLS File
		sh = OleApp.application.application.WorkBooks(1).Sheets(m.lnSheet)
		sh.select

		lcStr = OleApp.application.ActiveSheet.name

** Do this only for non-SUMMARY sheets in the spreadsheet
		if !("SUMMARY" $ upper(m.lcStr))

			lnDoneSheets = m.lnDoneSheets + 1
				
			** Delete first N unused rows
			for lnRow = 1 to m.tnStartFromRow
				sh.range("A" + alltrim(str(m.lnRow))).select
				OleApp.application.selection.EntireRow.delete
			endfor			
For some strange reason this code deletes wrong rows, not the first tnStartFromRow

Do you see what I'm doing wrong?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform