已经解决,多谢各位大神帮忙
程序代码:
f_t1='E:\futong\pupi_CUR.xls' f_tp= JUSTpath(f_t1)+'\' f_tn=JUSTSTEM(f_t1) f_tt=JUStext(f_t1) f_t3=f_tp+f_tn+'.txt' IF USED('feildname ') SELECT feildname USE ELSE CREATE CURSOR feildname (fname c(20)) ENDIF myexcel=createobject('excel.application') WITH myexcel .visible=.F. .DisplayAlerts=.f. .workbooks.open(f_t1) Usedrow1 =.workbooks(f_t1).sheets(1).UsedRange.Rows.Count Usedcol1 =.workbooks(f_t1).sheets(1).UsedRange.columns.Count FOR i1=1 TO Usedcol1 cell2=+'1,'+ALLTRIM(STR(i1)) feild_t=.ActiveWorkbook.sheets(1).cells(&cell2).value ?feild_t ?ISNULL(feild_t) SELECT * FROM feildname WHERE ALLTRIM(fname)=ALLTRIM(feild_t)into CURSOR temp1 rec_t=recc() DO CASE CASE ISNULL(feild_t)=.t. feild_t='a'+ALLTRIM(STR(i1)) CASE (BETWEEN(asc(LEFT(feild_t,1)),65,90)or BETWEEN(asc(LEFT(feild_t,1)),97,122)) AND rec_t#0 feild_t=ALLTRIM(feild_t) CASE ASC(LEFT(feild_t,2))>10000 feild_t=ToPy(feild_t) ENDCASE INSERT INTO feildname (fname )values (feild_t) IF i1=1 CREATE CURSOR &f_tn (&feild_t v(100)) ELSE ALTER table &f_tn ADD COLUMN &feild_t v(100) ENDIF ENDFOR .ActiveSheet.UsedRange.Select WITH .Selection .Columns.WrapText = .F. .Columns.AutoFit nRow = .Rows.Count - 1 nColumn = .Columns.Count LOCAL ArrayName[nRow, nColumn] ArrayName = .Cells(2, 1).Resize(nRow, nColumn).Value ENDWITH INSERT INTO &f_tn FROM ARRAY ArrayName .ActiveWorkbook.saved=.f. .Workbooks.Close .DisplayAlerts=.t. .quit ENDWITH