Foxtable(狐表)用户栏目专家坐堂 → 使用vba 生成的word报表总是会多一行空行


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

主题:使用vba 生成的word报表总是会多一行空行

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/5/9 9:28:00 [显示全部帖子]

1、        For Each dr As DataRow In drs
            For Each dc As String In li
                If dc = "序号" Then
                    app.Selection.TypeText(Text:= CStr(i))
                ElseIf dc <> "序号" Then
                    app.Selection.TypeText(Text:=dr(dc) )
                End If
if i < drs.count
                app.Selection.MoveRight(Unit:=12)
end if
                i = i + 1
            Next
        Next
2、传递模板文件路径、表格数据如drs、表格列名如li
3、使用另存saveas
doc.SaveAs("c:\123.doc")

 回到顶部