* Need xlConstants.h or explicitly define used xl* constants
#include "xlConstants.h"
USE home()+"samples\data\customer"
Application.datatoclip("customer",reccount(),3)
oExcel = createobject("Excel.application")
WITH oExcel
.WorkBooks.Add
WITH .ActiveSheet
.Range("D9").select
.Paste
.Range("A1").select
.Range("A1").SpecialCells(xlLastCell).CurrentRegion.Select
lcStartRow = .Application.selection.rows(1).Address(.f.,.f.,xlA1) && D9:P9
lnStartRow = val(substr(lcStartRow,2)) && 9
lcNewRow = strtran(lcStartRow, ltrim(str(lnStartRow)), "1") && D1:P1
lcNextRow = strtran(lcStartRow, ltrim(str(lnStartRow)), "2") && D2:P2
lcFillRange = substr(lcNextRow,1, at(":",lcNextRow) ) + ;
substr(lcStartRow, 1, at(":",lcNextRow)-1 )
.Range(lcStartRow).cut
.Range(lcNewRow).select
.Paste && Moved header to row 1
.Range(lcFillRange).value = "-" && Fill dummy "-" so included in import
.SaveAs("c:\temp\myimport.xls",xlExcel5)
ENDWITH
.WorkBooks(1).saved = .t.
.quit
* .visible = .t.
ENDWITH
IMPORT from ("c:\temp\myimport.xls") type xl5
BROW