打开开发工具

右击功能区->自定义功能区

勾选开发工具->确定

导入代码

开发工具选项卡->Visual Basic

右击Normal->插入->模块

粘贴代码->ctrl+s 保存

Sub 修改样式()

    ' 八号磅值5
' 七号磅值5.5
' 小六磅值6.5 六号磅值7.5
' 小五磅值9 五号磅值10.5
' 小四磅值12 四号磅值14
' 小三磅值15 三号磅值16
' 小二磅值18 二号磅值22
' 小一磅值24 一号磅值26
' 小初磅值36 初号磅值42 ' 删除用户所有自定义样式
For Each sty In ActiveDocument.Styles
If sty.BuiltIn = False Then sty.Delete
Next sty '标题1样式
With ActiveDocument.Styles(wdStyleHeading1).Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 16 '字号,请输入对应数字
.Bold = 1 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles(wdStyleHeading1).ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphCenter ' 居中对齐
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0.5 '段前为0.5行
.LineUnitAfter = 0.5 '段后为0.5行
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With '标题2样式
With ActiveDocument.Styles(wdStyleHeading2).Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 14 '字号,请输入对应数字
.Bold = 1 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphJustify
.CharacterUnitFirstLineIndent = 0 ' 首行缩进0字符
.LineUnitBefore = 0.5
.LineUnitAfter = 0.5
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With '标题3样式
With ActiveDocument.Styles(wdStyleHeading3).Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 14 '字号,请输入对应数字
.Bold = 1 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles(wdStyleHeading3).ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphJustify
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With '标题4样式
With ActiveDocument.Styles(wdStyleHeading4).Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 14 '字号,请输入对应数字
.Bold = 1 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles(wdStyleHeading4).ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphJustify
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With '标题5样式
With ActiveDocument.Styles(wdStyleHeading5).Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 14 '字号,请输入对应数字
.Bold = 1 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles(wdStyleHeading5).ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphJustify
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With ' 正文样式
With ActiveDocument.Styles("正文").Font
.Color = wdColorAutomatic
.NameFarEast = "宋体"
.NameAscii = "Times New Roman"
.Size = 12 '字号,请输入对应数字
.Bold = 0 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles("正文").ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphJustify
.CharacterUnitFirstLineIndent = 2
.LineUnitBefore = 0 '段前为0.8行
.LineUnitAfter = 0 '段后为0.5行
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 23
End With ' 图标表
Application.ScreenUpdating = False '关闭屏幕更新
ActiveDocument.Styles.Add Name:="图标表", Type:=wdStyleTypeParagraph
ActiveDocument.Styles("图标表").AutomaticallyUpdate = False
With ActiveDocument.Styles("图标表").Font
.Color = wdColorAutomatic
.NameFarEast = "楷体"
.NameAscii = "Times New Roman"
.Size = 10.5 '字号,请输入对应数字
.Bold = 0 '加粗为1,不加粗为0
End With
With ActiveDocument.Styles("图标表").ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.Alignment = wdAlignParagraphCenter
'.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0.5
.LineUnitAfter = 0.5
.OutlineLevel = wdOutlineLevelBodyText ' 大纲级别普通文本
.LineSpacingRule = wdLineSpaceSingle
End With End Sub Sub 设置图标表()
Selection.Style = "图标表"
End Sub

自定义功能

右击功能区->自定义功能区

点击开始->新建组->点击刚创建的组->重命名

点击自定义样式->选择宏->选择相应的函数->添加->选择刚添加的函数->重命名并设置图标

完工

最后点击相应的相应的样式,便可应用及自动产生大纲级别

Word 脚本 (自用)的更多相关文章

  1. 60天shell脚本计划-5/12-渐入佳境

    --作者:飞翔的小胖猪 --创建时间:2021年2月16日 --修改时间:2021年2月20日 说明 每日上传更新一个shell脚本,周期为60天.如有需求的读者可根据自己实际情况选用合适的脚本,也可 ...

  2. STORM_0007_Multi-Lang protocol of Storm/多语言协议的翻译

    原始地址: http://storm.apache.org/releases/1.0.1/Multilang-protocol.html 这个协议试用0.7.1之后的版本   通过ShellBolt和 ...

  3. 曾Python培训讲师-2年Python开发无包装简历-20191217-可公开

    目录 个人介绍 技能介绍 项目经历 自我评价 简历非完整版,需要完整版看下述信息,禁止任何一切私人用途.转发 我生日是27号,那就27元一份,有需求的来购买!只会涨价不会降价,大概卖10份涨1元:曾P ...

  4. word 宏,脚本编程

    '脚本方式新建word 再新建文档,文档中输入字符串"你好" Dim wdapp As Word.Application Dim wddoc As Word.Document Se ...

  5. Tampermonkey脚本安装问题及自用脚本推荐

    对于高手来说,chrome浏览器中即使没有其他任何chrome插件,可能都无关紧要.但是有一个插件必不可少, 那就是Tampermonkey油猴插件.Tampermonkey是Chrome上最流行的用 ...

  6. 某阅读多word整理自动化脚本

    版权声明:本文为博主原创文章,转载 请注明出处:https://blog.csdn.net/sc2079/article/details/101055192 - 写在前面 最近想练习英语,发现电脑磁盘 ...

  7. doc或docx(word)或image类型文件批量转PDF脚本

    doc或docx(word)或image类型文件批量转PDF脚本 1.实际生产环境中遇到文件展示只能适配PDF版本的文件,奈何一万个文件有七千个都是word或者image类型的,由此搞个脚本批量转换下 ...

  8. 分享一个自用的 Inno Setup 软件打包脚本

    此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...

  9. word vbs脚本 设置所有题注样式为蓝色,下划线

    Attribute VB_Name = "题注样式" Sub SetCorssRef() 'Word版,设置所有交叉引用的文本的格式 Dim aField As Word.Fiel ...

随机推荐

  1. Java并发包源码学习系列:AQS共享式与独占式获取与释放资源的区别

    目录 Java并发包源码学习系列:AQS共享模式获取与释放资源 独占式获取资源 void acquire(int arg) boolean acquireQueued(Node, int) 独占式释放 ...

  2. Akka Typed 官方文档之随手记

    ️ 引言 近两年,一直在折腾用FP与OO共存的编程语言Scala,采取以函数式编程为主的方式,结合TDD和BDD的手段,采用Domain Driven Design的方法学,去构造DDDD应用(Dom ...

  3. chatsRoom Design Report

    基于TCP实现聊天室 主要使用四个类 ChatClient类     使用BufferedReader 得到输入流,使用OutputStream得到输出流     实现读取服务器广播的消息和发送消息到 ...

  4. idea thymeleaf页面变量报错解决

    IDEA在thymeleaf页面编写变量,如${user.id}会出现红色波浪下划线错误,提示Validates unresolved references and invalid expressio ...

  5. binlog-do-db

    如果只是对一个数据库设置,其实没有效果的,其他数据还是会记录binlog的 binlog-ignore-db =database b  binlog日志里面将不会记录database b的所有相关的操 ...

  6. 【IMPDP】ORA-31655

    出现ora-31655错误的情况是因为不是同一个schema,导致的问题产生 解决的方法; 在导入语句最后添加上remap_schema=old:new 着old是原schema,也就是导出的用户名, ...

  7. 【Mysql】[Err] 1153 - Got a packet bigger than 'max_allowed_packet' bytes

    今天用Navicat导入的时候报错 [Err] 1153 - Got a packet bigger than 'max_allowed_packet' bytes 原因是数据库默认是16M的数据,这 ...

  8. P1220 关路灯(区间规划)

    题目描述 某一村庄在一条路线上安装了n盏路灯,每盏灯的功率有大有小(即同一段时间内消耗的电量有多有少).老张就住在这条路中间某一路灯旁,他有一项工作就是每天早上天亮时一盏一盏地关掉这些路灯. 为了给村 ...

  9. ctfhub技能树—信息泄露—hg泄露

    打开靶机 查看页面信息 使用dvcs-ripper工具进行处理 ./rip-hg.pl -v -u http://challenge-cf630b528f6f25e2.sandbox.ctfhub.c ...

  10. synchronized的jvm源码分析聊锁的意义

    上篇写完了ReentrantLock源码实现,从我们的角度分析设计锁,在对比大神的实现,顺道拍了一波道哥的马屁,虽然他看不到,哈哈.这一篇我们来聊一聊synchronized的源码实现,并对比reen ...