VBA添加表格
2016-04-18 10:23
585 查看
Sub 添加表格() ' If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then For i = 1 To ActiveDocument.Tables.Count Dim myTable As Table Set myTable = ActiveDocument.Tables(i) myTable.Rows.Last.Select Selection.InsertRowsBelow 1 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:=1, NumColumns:=3, 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:=3, Extend:=wdExtend Selection.Cells.Merge Selection.MoveRight Unit:=wdCell Selection.TypeText Text:="测试人" Selection.MoveRight Unit:=wdCell Selection.Cells.Split NumRows:=1, NumColumns:=3, 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:=1 Selection.MoveUp Unit:=wdLine, Count:=1 Selection.TypeText Text:="无" Selection.SelectCell Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter Selection.MoveDown Unit:=wdLine, Count:=1 Selection.MoveRight Unit:=wdCharacter, Count:=5 Selection.SelectCell Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter Next MsgBox ("完成") Else MsgBox ("任务取消") End If End Sub
相关文章推荐
- vb6中word编程总结
- 详解AOPR中的VBA后门功能
- 15 电气 齐振昊 VB中三位数乘一位数
- 15 电气 齐振昊 VB中两位数乘一位数
- VB中几种循环结构
- echo写vbs下载者木马
- VBA批量调整图片宽度
- vb6.0陈伟教学视频总结
- VB.NET章鱼哥出品—怎样解决MDI子窗口被父窗口中的控件覆盖的问题
- VB延时模块,6种做法汇总
- What are CBR, VBV and CPB?
- 2016年4月TIOBE编程语言排行榜 Visual Basic正渐行渐远
- VB里面的字体颜色
- vb一位数乘一位数阶乘
- vb15个数字作业
- Vb两位数乘一位数 电气2012
- 上周4月7号VB
- VB排序
- VB中两个数乘以一个数
- 15电气郄慧敏vb作业计算一位数乘以一位数