what is the easiest way to remove duplicate rows - rows that have the same selected columns, i.e. not all for the created Excel file?
I can also do it through the database using the UNIQUE index, but it's more complicated.
I'm trying what I found on the internet for VBA, but I don't know the syntax for Xbase++, it gives me an error
Code: Select all
oExcel:=CreateObject("Excel.Application")
IF Empty( oExcel )
ladenie( "Microsoft Excel nie je nainštalovaný, Active X sa nedá vytvoriť !" )
ENDIF
oExcel:Visible := .f.
cExcelFile:="d:\PROGSA\RAUKNW\TLAC\MYLE3\POKUS.XLS"
IF !FExists(cExcelFile)
DC_WinAlert( 'File does not exist:' + Chr(13) + cExcelFile )
ENDIF
oBook:=oExcel:workbooks:open( cExcelFile )
aValues := oBook:workSheets(1):usedRange:value // only for test if can read info from xls to array
ActiveSheet:UsedRange:RemoveDuplicates:Columns:=Array(1,2,3,4,5):Header:=xlYes
* I do not know if need set this :
*oSheet := oBook:Worksheets(1)
*oSheet:Rng:RemoveDuplicates:Columns:=Array(1,2,3,4,5):Header:=xlYes
* or also this
*Rng:=Range("A1:D1")
*oSheet:Rng:RemoveDuplicates:Columns:=Array(1,2,3,4,5):Header:=xlYes
*and what else ...
oBook:close()
oBook:destroy()
// Quit Excel
oExcel:Quit()
oExcel:Destroy()
wtf aValues