打开开发工具

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

勾选开发工具->确定

导入代码

开发工具选项卡->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. 【函数分享】每日PHP函数分享(2021-1-8)

    explode() 使用一个字符串分割另一个字符串. array explode( string $delimiter , string $string [, int $limit ]) 参数描述de ...

  2. swack的wiki站上线

    swack的个人wiki网址:www.swack.cn [服务器破旧,速度较慢,见谅!]

  3. Laya 踩坑日记 ---A* 导航寻路

    要做寻路,然后看了看laya 官方的例子,感觉看的一脸懵逼,早了半天的api 也没找到在哪有寻路的,最后一看代码,原来是用的github上的A星方案  https://github.com/bgrin ...

  4. 【C++】《Effective C++》第一章

    第一章 让自己习惯C++ C++是一个威力强大的语言,带着众多特性,但是在你可以驾驭其威力并有效运用其特性之前,你必须先习惯C++的办事方式. 条款01:视C++为一个语言联邦 如今的C++已经是个多 ...

  5. mac配置Android SDK

    下载地址:http://tools.android-studio.org/index.php/sdk 2.找到tools文件夹 选中android-sdk-macosx包下的tools文件夹,按com ...

  6. 从一次生产消费者的bug看看线程池如何增加线程

    0 背景 某个闲来无事的下午,看到旧有的项目中,有个任务调度的地方都是同步的操作,就是流程A的完成依赖流程B,流程B的完成依赖流程C,按此类推. 作为一名垃圾代码生产者,QA的噩梦.故障报告枪手的我来 ...

  7. /etc/hosts文件

    这个文件告诉主机哪些域名对应哪些ip,哪些主机名对应哪些ip. 一般也三个域 网络ip地址 主机名或域名 主机名别名 两部分的时候 主机ip地址和主机名

  8. eCATT使用前的配置

    如果想在SAP中使用eCATT,必须做一下相关的配置才行,下面简单介绍这几步:1.SM30,输入表T000,然后点击维护,或者是进入事物SCC4,进入对应的clint属性编辑视图下,将CATT and ...

  9. layui表格数据统计

    //执行一个 table 实例 table.render({ elem: '#demo' ,height: 420 ,url: '/demo/table/user/' //数据接口 ,title: ' ...

  10. Jmeter二次开发——自定义函数

    在之前的博文中,Jmeter二次开发--基于Java请求,已介绍了Jmeter二次开发的基础情况,上次分享的是java请求开发,今天来分享下Jmeter中的函数开发.聊到Jmeter的函数,知道Jme ...