Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting n first rows from Excel
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Deleting n first rows from Excel
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01127452
Message ID:
01127452
Views:
69
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
Next
Reply
Map
View

Click here to load this message in the networking platform