1、宏的代码如下。

Sub 设置代码表格()
' author: code4101
' 设置代码表格 宏
'
'
' 背景色为morning的配色方案,RGB为(229,229,229)
With Selection.Tables()
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor =
End With
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
.AutoFitBehavior (wdAutoFitContent) '自动调整大小
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With ' 段落无首行缩进,行间距为固定值12磅
With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints()
.RightIndent = CentimetersToPoints()
.SpaceBefore =
.SpaceBeforeAuto = False
.SpaceAfter =
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing =
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = CentimetersToPoints()
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent =
.CharacterUnitRightIndent =
.CharacterUnitFirstLineIndent =
.LineUnitBefore =
.LineUnitAfter =
.MirrorIndents = False
.TextboxTightWrap = wdTightNone
.AutoAdjustRightIndent = True
.DisableLineHeightGrid = False
.FarEastLineBreakControl = True
.WordWrap = True
.HangingPunctuation = True
.HalfWidthPunctuationOnTopOfLine = False
.AddSpaceBetweenFarEastAndAlpha = True
.AddSpaceBetweenFarEastAndDigit = True
.BaseLineAlignment = wdBaselineAlignAuto
End With
' 清除原有的段落底纹
Selection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorAutomatic
End Sub Sub 输入连续数字()
' author: code4101
行数 = InputBox("请输入代码终止行数", "输入行数", "")
For i = To 行数 -
Selection.TypeText Text:=i
Selection.TypeParagraph
Next
Selection.TypeText Text:=行数
End Sub

2、新建一个2行1列的表格  进行调用宏。

最新文章

  1. XPlane android 2D手游开发实战
  2. iOS中坐标转换
  3. 在 Excel 中使用正则表达式进行查找与替换
  4. C++容器类概述
  5. PYTHON发送邮件时,有的服务器不用密码认证的
  6. jszs 枚举算法
  7. STL源码剖析之_allocate函数
  8. swift字典集合-备
  9. CairoSVG - Convert SVG to PNG or PDF - Contents
  10. java打印各种菱形
  11. MSSQL基础
  12. 帝国cms
  13. Iterator(es6)
  14. 关于springmvc配置validator的注意事项
  15. 美团java后台实习三面
  16. Windows 版 SourceTree 免登录跳过初始设置的方法
  17. 阿里云免费SSL证书申请与安装使用(IIS7)
  18. linux下查看php-fpm是否开启以及如何开启
  19. i2c触摸屏驱动文件的实现
  20. Centos7调整swap分区

热门文章

  1. php curl 登陆百度贴吧(经历记录)
  2. cmd中可以运行java,但不能运行javac命令
  3. 关闭 Identity 插入限制
  4. js中DOM 节点的一些操作方法
  5. LeetCode 33——搜索旋转排序数组
  6. pexpect获取远端命令执行结果
  7. Jquery 跨域请求JSON数据问题
  8. PokeCats开发者日志(六)
  9. 从零开始配置Jenkins(一)——基本配置
  10. 【bzoj2326】[HNOI2011]数学作业 矩阵乘法