| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3499 人关注过本帖
标题:求教excel单元格中,有TAB,APPEND FROM后不能正常,怎么解决,谢谢!
取消只看楼主 加入收藏
fifowl2001
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2020-9-12
收藏
得分:0 
已经解决,多谢各位大神帮忙
2021-05-29 11:57
fifowl2001
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2020-9-12
收藏
得分:0 
程序代码:
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
2021-05-31 10:18
快速回复:求教excel单元格中,有TAB,APPEND FROM后不能正常,怎么解决,谢谢!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017164 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved