Word 脚本 (自用)
打开开发工具
右击功能区->自定义功能区

勾选开发工具->确定

导入代码
开发工具选项卡->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 脚本 (自用)的更多相关文章
- 60天shell脚本计划-5/12-渐入佳境
--作者:飞翔的小胖猪 --创建时间:2021年2月16日 --修改时间:2021年2月20日 说明 每日上传更新一个shell脚本,周期为60天.如有需求的读者可根据自己实际情况选用合适的脚本,也可 ...
- STORM_0007_Multi-Lang protocol of Storm/多语言协议的翻译
原始地址: http://storm.apache.org/releases/1.0.1/Multilang-protocol.html 这个协议试用0.7.1之后的版本 通过ShellBolt和 ...
- 曾Python培训讲师-2年Python开发无包装简历-20191217-可公开
目录 个人介绍 技能介绍 项目经历 自我评价 简历非完整版,需要完整版看下述信息,禁止任何一切私人用途.转发 我生日是27号,那就27元一份,有需求的来购买!只会涨价不会降价,大概卖10份涨1元:曾P ...
- word 宏,脚本编程
'脚本方式新建word 再新建文档,文档中输入字符串"你好" Dim wdapp As Word.Application Dim wddoc As Word.Document Se ...
- Tampermonkey脚本安装问题及自用脚本推荐
对于高手来说,chrome浏览器中即使没有其他任何chrome插件,可能都无关紧要.但是有一个插件必不可少, 那就是Tampermonkey油猴插件.Tampermonkey是Chrome上最流行的用 ...
- 某阅读多word整理自动化脚本
版权声明:本文为博主原创文章,转载 请注明出处:https://blog.csdn.net/sc2079/article/details/101055192 - 写在前面 最近想练习英语,发现电脑磁盘 ...
- doc或docx(word)或image类型文件批量转PDF脚本
doc或docx(word)或image类型文件批量转PDF脚本 1.实际生产环境中遇到文件展示只能适配PDF版本的文件,奈何一万个文件有七千个都是word或者image类型的,由此搞个脚本批量转换下 ...
- 分享一个自用的 Inno Setup 软件打包脚本
此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...
- word vbs脚本 设置所有题注样式为蓝色,下划线
Attribute VB_Name = "题注样式" Sub SetCorssRef() 'Word版,设置所有交叉引用的文本的格式 Dim aField As Word.Fiel ...
随机推荐
- Windows下使用Graalvm将Javafx应用编译成exe
1 背景 Graalvm是Oracle推出的一款新型虚拟机,其中一个吸引人的功能是:它可以将Java代码编译成各个平台的本地代码,这些平台包括:linux.macOS.windows.iOS.andr ...
- 单线程的as-if-serial语义
单线程的as-if-serial语义 关于指令重排序有个问题不明白的一个问题 int a = 2; int c = 1 + a; float b = 3f / 2f; 举个栗子,从CPU的设计者以及编 ...
- 02--Docker配置阿里云镜像加速器
1.登录阿里云控制台,在产品与服务中收索 "容器镜像服务" 2.点击镜像加速器,CentOS 3.在路径 /etc/docker/daemon.json 下配置加速器地址 4.重新 ...
- 被集群节点负载不均所困扰?TKE 重磅推出全链路调度解决方案
引言 在 K8s 集群运营过程中,常常会被节点 CPU 和内存的高使用率所困扰,既影响了节点上 Pod 的稳定运行,也会增加节点故障的几率.为了应对集群节点高负载的问题,平衡各个节点之间的资源使用率, ...
- Graph Explore的使用介绍
我在Graph API开发中用的最多的测试工具就是Graph Explore,这个是微软开发的网页版的Graph API的测试工具,能满足我大部分需求. 访问网址是:Graph Explorer - ...
- 20V,24V转5V,20V,24V转3.3V降压芯片,IC介绍
常用的20V和24V转5V,3.3V的LDO稳压和DC-DC降压芯片: PW6206系列是一款高精度,高输入电压,低静态电流,高速,低压降线性稳压器具有高纹波抑制.输入电压高达40V,负载电流高达10 ...
- 企业项目迁移go-zero全攻略(二)
承接上篇:上篇文章讲到 go-zero 架构设计和项目设计.本篇文章接着这个项目设计,将生成的 app 模块 中 gateway 和 RPC 进行改造.废话不多说,让我们开始! gateway ser ...
- Qt Undo Framework
Qt undo/redo 框架 基于Command设计模式 支持命令压缩和命令合成 提供了与工具包其他部分融合很好的widgets和actions 术语(Terminology) Command - ...
- mysql(连接查询和数据库设计)
--创建学生表 create table students ( id int unsigned not null auto_increment primary key, name varchar(20 ...
- XShell下便捷上载/下载文件到虚拟机
1.客户机联网后,安装 rz,sz 服务,命令如下: yum install lrzsz 2.XShell连接客户机: 2.1 上传文件:运行rz,在弹窗内选择Windows本地文件上传到客户机当前目 ...