Sub 添加表格()
'
If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then
For i = To ActiveDocument.Tables.Count Dim myTable As Table
Set myTable = ActiveDocument.Tables(i)
myTable.Rows.Last.Select Selection.InsertRowsBelow
Selection.Collapse Direction:=wdCollapseStart
Selection.TypeText Text:="实际结果"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="与期望结果一致"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="测试结果"
Selection.MoveRight Unit:=wdCell
Selection.Cells.Split NumRows:=, NumColumns:=, MergeBeforeSplit:=False
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="通过"
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="缺陷编号"
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="备注"
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCharacter, Count:=, Extend:=wdExtend
Selection.Cells.Merge
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="测试人"
Selection.MoveRight Unit:=wdCell
Selection.Cells.Split NumRows:=, NumColumns:=, MergeBeforeSplit:=False
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="XXX"
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="测试日期"
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="2016-4-18"
Selection.MoveLeft Unit:=wdCharacter, Count:=
Selection.MoveUp Unit:=wdLine, Count:=
Selection.TypeText Text:="无"
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveDown Unit:=wdLine, Count:=
Selection.MoveRight Unit:=wdCharacter, Count:=
Selection.SelectCell
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter Next
MsgBox ("完成")
Else
MsgBox ("任务取消")
End If
End Sub

VBA添加表格的更多相关文章

  1. OpenXml入门----给Word文档添加表格

    下面将展示如何使用Openxm向Word添加表格. 代码中表头和数据我用的同一个TableRow来添加,其实可以通过TableHeader来,其实都一样.后面教程我会给出如何设置单元格样式.表头那一行 ...

  2. jquery 动态添加表格行

    jquery 动态添加表格行 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <h ...

  3. C# 在Word中添加表格的方法

    表格是组织整理数据的一种重要手段,应在生活中的方方面面.在Word文档中将繁杂的文字表述内容表格化,能快速.直接地获取关键内容信息.那么,通过C#,我们也可以在Word文档中添加表格,这里将介绍两种不 ...

  4. JQuery动态添加表格,然后动态删除不成功问题

    背景: 自己做了一个测试网页,想动态添加表格,然后删除,按照网上的教程写完,发现点击"删除参数"按钮没用 源码: function addtr() { var trinfo = & ...

  5. Java 在PDF中添加表格

    本文将介绍通过Java编程在PDF文档中添加表格的方法.添加表格时,可设置表格边框.单元格对齐方式.单元格背景色.单元格合并.插入图片.设置行高.列宽.字体.字号等. 使用工具:Free Spire. ...

  6. 从头开始一步一步实现EF6+Autofac+MVC5+Bootstarp极简前后台ajax表格展示及分页(二)前端修改、添加表格行点击弹出模态框

    在前一篇中,由于不懂jquery,前端做的太差了,今天做稍做修改,增加一个跳转到指定页面功能,表格行点击样式变化.并且在表格中加入bootstarp的按钮组,按钮点击后弹出模态框,须修改common, ...

  7. VBA删除表格最后一行

    Sub 删除最后一行() If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then To ActiveDocument ...

  8. js动态向页面中添加表格

    我们在实际开发中经常会想要实现如下情况: 点击某个按钮,然后动态的网页面里面添加一个表格或者一行,这个更加灵活方便.但是实现起来肯定不能像在页面里面直接写标签来的容易,以下是我项目中的代码,拿过来分享 ...

  9. js动态添加-表格逐行添加、删除、遍历取值

    关于js对表格进行逐行添加,今天抽空整理了一下:新建一个html文件(没有编辑器的可以新建一个demo.txt文件,然后改后缀名为demo.html),把下面代码全部贴进去即可.功能包括:表格添加一行 ...

随机推荐

  1. 修改Jenkins启动衍生进程的生命周期

    Jenkins+jmeter 多线程测试java接口时爆错,导致无法生成html报告. 先介绍下场景: 在Jenkins中新建了一个Job,假设你在一些列Build Step之前/之后,启动了一个进程 ...

  2. cmd 登录oracle

    源地址:http://zhidao.baidu.com/link?url=mehN7bFY14DGH6DwhpbJnAbzb_fI3WbQn2-WqVInyyqHkfYlZSfu7GQVjQgQoPV ...

  3. 编写webpy程序,iep 报错,ulipad 运行正确

    在web.py编程中,使用模板文件时,iep下会报错.ulipad不会报错. 用python 运行不报错. 在寻找答案.初步估计是iep的python运行环境有问题. 如图:

  4. Java 线程间通讯(共享变量方式)

    Java线程间通讯,最常用的方式便是共享变量方式,多个线程共享一个静态变量就可以实现在线程间通讯,但是这需要注意的就是线程同步问题. 一.没考虑线程同步: package com.wyf; publi ...

  5. nyoj 54-小明的存钱计划

    点击打开链接 小明的存钱计划 时间限制:3000 ms  |  内存限制:65535 KB 难度:2 描述 小明的零花钱一直都是自己管理.每个月的月初妈妈给小明300元钱,小明会预算这个月的花销,并且 ...

  6. 蓝桥杯---数独(模拟 || dfs)

    [编程题](满分33分) "数独"是当下炙手可热的智力游戏.一般认为它的起源是"拉丁方块",是大数 学家欧拉于1783年发明的. 如图[1.jpg]所示:6x6 ...

  7. linux内核调试指南

    linux内核调试指南 一些前言 作者前言 知识从哪里来 为什么撰写本文档 为什么需要汇编级调试 ***第一部分:基础知识*** 总纲:内核世界的陷阱 源码阅读的陷阱 代码调试的陷阱 原理理解的陷阱 ...

  8. php文件删除unlink()详解

    请记住从PHP文件创建的教训,我们创建了一个文件,名为testFile.txt . $myFile = "testFile.txt"; $fh = fopen($myFile, ' ...

  9. 64位CentOS 6.4下安装wine

    From: http://zhidao.baidu.com/question/530358126.html From: http://hi.baidu.com/billdkj/item/464fb84 ...

  10. Appium + Python -------------元素定位

    说在前面 1.https://github.com/appium/python-client/tree/master/test  里面有一些test ,可以看看,研究研究 2.学会使用 uiautom ...