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),把下面代码全部贴进去即可.功能包括:表格添加一行 ...
随机推荐
- 名词解释:DRAM, SRAM, SDRAM等
SRAM:静态RAM,不用刷新,速度可以非常快,像CPU内部的cache,都是静态RAM,缺点是一个内存单元需要的晶体管数量多,因而价格昂贵,容量不大. DRAM:动态RAM,需要刷新,容量大. SD ...
- Ext 4.2 RowEditing
Follow: function () { Ext.define('Follow', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ { ...
- [SQL]SQL语言入门级教材_SQL功能与特性(一)
SQL功能与特性 其实,在前面的文章中,已经提及SQL命令的一些基本功能.然而,通过 SQL命令,程序设计师或数据库管理员(DBA)可以: (一)建立数据库的表格.(包括设置表格所可以使用之空间) ( ...
- Altera SoC 内核更新3.7到3.10
为什么需要更新呢?其实是为了更好的搭建自己的开发环境,同时熟悉altera对代码的更新和管理方式,便于进一步的熟悉和了解altera SoC开发过程. 1.下载linux代码: git clone ...
- 共享池之六:shared pool latch/ library cache latch /lock pin 简介
latch:library cache --desc v$librarycache; latch:library cache用于保护hash bucket.library cache lock保护HA ...
- transform的使用
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- CString.Format的详细用法(转)
CString.Format的详细用法(转) 在MFC程序中,使用CString来处理字符串是一个很不错的选择.CString既可以处理Unicode标准的字符串,也可以处理ANSI标准的字符串.CS ...
- DZ!NT论坛 3.6.711删除用户各种错解决方案
DZ!NT论坛 3.6.711删除用户各种错解决方案 首先删除一个用户~ado.net报错 对象名 'dnt_spaceposts' 无效. 对象名 'dnt_spaceconfigs' 无效. ...
- 图像JPEG格式介绍
1 JPG格式介绍 JPEG (Joint PhotographicExperts GROUP)是由国际标准组织和国际电话电报咨询委员会为静态图像所建立的第一个国际数字图像压缩标准,也是至今一直在使用 ...
- Orchard官方文档翻译(一) 总览
原文地址:http://docs.orchardproject.net/ 最近想要学习了解orchard,但却没有找到相关的中文文档,只有英文文档.于是决定自行翻译,以便日后方便翻阅. 转载请注明原作 ...