打开开发工具

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

勾选开发工具->确定

导入代码

开发工具选项卡->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. ABP vNext 审计日志获取真实客户端IP

    背景 在使用ABP vNext时,当需要记录审计日志时,我们按照https://docs.abp.io/zh-Hans/abp/latest/Audit-Logging配置即可开箱即用,然而在实际生产 ...

  2. 在md里画流程图

    可以使用名为mermaid的代码块,即 ```mermaid``` 需要md解析器能解析mermaid mermaid使用详情参见

  3. Sentry(v20.12.1) K8S 云原生架构探索,SENTRY FOR JAVASCRIPT SDK 配置详解

    系列 Sentry-Go SDK 中文实践指南 一起来刷 Sentry For Go 官方文档之 Enriching Events Snuba:Sentry 新的搜索基础设施(基于 ClickHous ...

  4. Java基础-数据类型及变量

    Java基本语法 1.标识符(zhi) 含义:名字 类名.对象名.方法名.变量名.常量名-- 一个合法的标识符的组成:数字.字母._和$ 注意事项: 不能重复 不能以数字开头 区分大小写 不能以关键字 ...

  5. LeetCode448-数组中消失的数字

    题目 给定一个范围在 1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次. 找到所有在 [1, n] 范围之间没有出现在数组中的数字. 您能 ...

  6. 为linux添加一块新硬盘并分区

    一---如何增加一块硬盘1:虚拟机添加硬盘2:分区3:格式化4:挂载5:设置可以自动挂载 1---设置里面 2---分区命令 fdisk /dev/sdb开始分区m显示命令列表p显示磁盘分区 同fdi ...

  7. JavaScript入门-对象

    js对象 本篇主要介绍js里如何创建对象,以及for循环访问对象的成员... 什么是对象? 对象,并不是中文里有男女朋友意思,它是从英文里翻译来的,英文叫[Object],目标,物体,物品的意思. 在 ...

  8. 【ORA】ORA-27090: Unable to reserve kernel resources for asynchronous disk I/O

    操作系统是CentOS 5.11 数据库 10.2.0.5.0 晚上查看数据库,发现数据库报错查看相关的trace文件内容如下: *** SERVICE NAME:(SYS$BACKGROUND) 2 ...

  9. bash5.0参考手册

    Bash Reference Manual a.summary-letter { text-decoration: none } blockquote.indentedblock { margin-r ...

  10. random模块常用函数

    random模块常用函数: from random import * # Random float: 0.0 <= x < 1.0 random() # Random float: 2.5 ...