Foxtable(狐表)用户栏目专家坐堂 → 为何下列只能在Excel2003下应用,在Excel2007以上版本出错


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

主题:为何下列只能在Excel2003下应用,在Excel2007以上版本出错

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/8/31 9:44:00 [显示全部帖子]

1、报什么错?

 

2、我测试下面代码没问题

 

Dim prs As Integer = 25 '每页细节区行数
Dim fl As Integer = 6 '每页栏数
Dim ls As Integer = 2 '每栏列数
Dim bts As Integer = 3 '表头数
Dim bws As Integer = 8 '表尾数
Dim tb As Table = Tables("表A")
Dim nms() = {"第一列", "第二列"}
Dim csh As Integer  '每页初始行
Dim s,g,lz,zh As Integer
'zh=prs  '每页总行数
zh=prs+bts+bws  '每页总行数


Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("d:\test.xlsx")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
App.ScreenUpdating = False
For p As Integer = 1 To math.Ceiling(tb.Rows.Count /( fl*prs)) - 1  'p分页
    Ws.Rows("1:" & zh).Copy(Ws.Range("a" & p*zh+1))
Next

Ws.Cells.PageBreak = MSExcel.XlPageBreak.xlPageBreakNone'清除所有分页符
Ws.Columns(fl*ls+1).PageBreak = MSExcel.XlPageBreak.xlPageBreakManual '纵向分页

For p As Integer = 0 To math.Ceiling(tb.Rows.Count /( fl*prs)) - 1  'p分页
    csh=bts+p*zh
    'csh=p*zh
    s = 0
    g = 1
   
    For r As Integer =  P*FL*prs To math.min(tb.Rows.Count - 1,( p + 1) *fl* prs - 1)  '在每页数据内循环
       
        lz = (Int(s/prs)) * ls+1  '指定数据列数
        If s/prs = Int((s+1)/prs)  Then g = 1
        ws.cells(csh+g,lz) = r+1
       
        For m As Integer = 0 To nms.Length-1
            ws.cells(csh+g,lz+m+1) = tb.rows(r)(nms(m))
        Next
        g = g + 1 '每页每列各数据累计次数
        s = s + 1 '每页各数据累计次数
       
    Next
    'msgbox((p+1)*zh+1)
    Ws.Rows((p+1)*zh+1).PageBreak = MSExcel.XlPageBreak.xlPageBreakManual
Next

Ws.PageSetup.CenterHeader = ""
'MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒") '计算并显示执行代码所花费的秒数
Wb.Save
App.ScreenUpdating =True
App.Visible = True
ws.PrintPreview

 

3、你ms office是不是安装的是64位版本的?尽量安装成32位版本的吧。或者试试安装

 

http://www.foxtable.com/download/AccessDatabaseEngine.exe

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/1/13 21:24:00 [显示全部帖子]

1、

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=54396&replyID=360697&skin=1

 

2、如果1无法修复,就重新安装一下wps。


 回到顶部