Foxtable(狐表)用户栏目专家坐堂 → 求代码!


  共有2765人关注过本帖树形打印复制链接

主题:求代码!

帅哥哟,离线,有人找我吗?
Bin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/7/21 8:58:00 [显示全部帖子]

dim files as string()={"c:\文件夹1\表1.xls","c:\文件夹2\表1.xls","c:\文件夹3\表1.xls"}
Tables("表A").StopRedraw()
for each file as string in files 
Dim Book As New XLS.Book(file) 
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim nms() As String = {"第一列","第二列","第三列"} 
For n As Integer = 1 To Sheet.Rows.Count -1 
    Dim bh As String = sheet(n,0).Text
    if bh <> "" then 
    If DataTables("表A").Find("第一列 = '" & bh & "'") Is Nothing Then 
        Dim r As Row = Tables("表A").AddNew()
        For m As Integer = 0 To nms.Length - 1
            r(nms(m)) = Sheet(n,m).Value
        Next
    End If
    end if
Next
next
Tables("表A").ResumeRedraw()

 回到顶部