VBA添加表格
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添加表格的更多相关文章
- OpenXml入门----给Word文档添加表格
下面将展示如何使用Openxm向Word添加表格. 代码中表头和数据我用的同一个TableRow来添加,其实可以通过TableHeader来,其实都一样.后面教程我会给出如何设置单元格样式.表头那一行 ...
- jquery 动态添加表格行
jquery 动态添加表格行 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <h ...
- C# 在Word中添加表格的方法
表格是组织整理数据的一种重要手段,应在生活中的方方面面.在Word文档中将繁杂的文字表述内容表格化,能快速.直接地获取关键内容信息.那么,通过C#,我们也可以在Word文档中添加表格,这里将介绍两种不 ...
- JQuery动态添加表格,然后动态删除不成功问题
背景: 自己做了一个测试网页,想动态添加表格,然后删除,按照网上的教程写完,发现点击"删除参数"按钮没用 源码: function addtr() { var trinfo = & ...
- Java 在PDF中添加表格
本文将介绍通过Java编程在PDF文档中添加表格的方法.添加表格时,可设置表格边框.单元格对齐方式.单元格背景色.单元格合并.插入图片.设置行高.列宽.字体.字号等. 使用工具:Free Spire. ...
- 从头开始一步一步实现EF6+Autofac+MVC5+Bootstarp极简前后台ajax表格展示及分页(二)前端修改、添加表格行点击弹出模态框
在前一篇中,由于不懂jquery,前端做的太差了,今天做稍做修改,增加一个跳转到指定页面功能,表格行点击样式变化.并且在表格中加入bootstarp的按钮组,按钮点击后弹出模态框,须修改common, ...
- VBA删除表格最后一行
Sub 删除最后一行() If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then To ActiveDocument ...
- js动态向页面中添加表格
我们在实际开发中经常会想要实现如下情况: 点击某个按钮,然后动态的网页面里面添加一个表格或者一行,这个更加灵活方便.但是实现起来肯定不能像在页面里面直接写标签来的容易,以下是我项目中的代码,拿过来分享 ...
- js动态添加-表格逐行添加、删除、遍历取值
关于js对表格进行逐行添加,今天抽空整理了一下:新建一个html文件(没有编辑器的可以新建一个demo.txt文件,然后改后缀名为demo.html),把下面代码全部贴进去即可.功能包括:表格添加一行 ...
随机推荐
- mac下使用github
提起github相信大家都不会陌生,在这里就不再赘述了.作为开源代码库以及版本控制系统,使用好了确实会非常受益,再说的势利点,你找工作时给面试官说你经常维护自己的技术博客和github,相信你给他的印 ...
- 山东省第三届ACM省赛
Solved ID PID Title Accepted Submit A 2407 Impasse (+) 0 0 B 2415 Chess 0 0 C 2414 An interest ...
- c++cin.ignore()
c++ 中cin.ignore(100,'\n'); 的作用是清除输入流中多余的字符请问这句话是什么意思? 可以举个例子吗? 提问者采纳 这个其实就是忽略cin中的前100个字符,或是'\n'之前的字 ...
- SVN提交数据失败问题(提示 svn:MKACTIVITY ... 403 Forbidden )
注册了淘宝svn,结果在代码提交是老是出问题,如下截图所示: 网上有常用的一种方法是: http://jingyan.baidu.com/article/67508eb4d3f2e29ccb1ce47 ...
- Codeforces 519E A and B and Lecture Rooms [倍增法LCA]
题意: 给你一棵有n个节点的树,给你m次询问,查询给两个点,问树上有多少个点到这两个点的距离是相等的.树上所有边的边权是1. 思路: 很容易想到通过记录dep和找到lca来找到两个点之间的距离,然后分 ...
- [HackerCup Round1 2] Autocomplete (Trie)
题目链接:https://www.facebook.com/hackercup/problems.php?pid=313229895540583&round=344496159068801 题 ...
- UI_RD协作开发流程
1. 背景 由于android端需要进行多屏幕适配,这就给UI&RD之间的沟通产生了一些困难.我下面将会对这两种角色的沟通,说明了一下我们项目中沟通的方式和规则. 原则:客户端跟UI约定了各种 ...
- 视频相关android软件
1. 视频解码工具:ffmpeg, http://www.ffmpeg.org/ 2. java有一个开源程序: yoyoPlayer, 可以到这个代码中去学习相关的音频知识.http://www.b ...
- sqoop安装
环境:Hadoop 2.3.0 sqoop 1.4.5 1.下载并解压sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz (解压完,名字会很长,可以根据需要自己修改下 ...
- 【摘】linux之shutdown、halt和reboot命令详解
在重新启动Linux系统的同时把内存中的信息写入硬盘,应使用()命令实现 #shutdown -r now #halt #reboot #init3 正确答案:A 在linux命令中reboot是 ...