vba在word文档中插入文字并设置相应的文字属性
下面的VBA代码功能,第一步,word当前文档的上面添加文字dzwebs文字。然后,又设置第一段居中对齐,并在该段落之后添加半英寸的间距。将dzwebs的格式设为36磅,隶书字体。
Dim rngFormat As Range
Set rngFormat = ActiveDocument.Range(Start:=0, End:=0)
With rngFormat
.InsertAfter Text:="dzwebs"
.InsertParagraphAfter
With .Font
.Name = "隶书"
.Size = 36
.Bold = True
End With
End With
With ActiveDocument.Paragraphs(1)
.Alignment = wdAlignParagraphCenter
.SpaceAfter = InchesToPoints(0.5)
End With
部分代码解释:
Dim rngFormat As Range定义变量
Set rngFormat = ActiveDocument.Range(Start:=0, End:=0)设置rngFormat变量的位置,位于文档的最上面
With rngFormat
里面的代码功能是设置字体字号等属性
End With
With ActiveDocument.Paragraphs(1)
.Alignment = wdAlignParagraphCenter
.SpaceAfter = InchesToPoints(0.5)
End With
该代码代码功能是添加段后距离为0.5英寸
您可能感兴趣的文章
- 06-25office2021永久免费激活方法
- 06-25office专业增强版2021激活密钥2023密钥永久激活 万能office2021密钥25位
- 06-25office2021年最新永久有效正版激活密钥免费分享
- 06-25最新office2021/2020激活密钥怎么获取 office激活码分享 附激活工具
- 06-25office激活密钥2021家庭版
- 06-25Office2021激活密钥永久最新分享
- 06-24Word中进行分栏文档设置的操作方法
- 06-24Word中进行文档设置图片形状格式的操作方法
- 06-24Word中2010版进行生成目录的操作方法
- 06-24word2007中设置各个页面页眉为不同样式的操作方法


阅读排行
推荐教程
- 11-30正版office2021永久激活密钥
- 11-25怎么激活office2019最新版?office 2019激活秘钥+激活工具推荐
- 11-22office怎么免费永久激活 office产品密钥永久激活码
- 11-25office2010 产品密钥 永久密钥最新分享
- 11-22Office2016激活密钥专业增强版(神Key)Office2016永久激活密钥[202
- 11-30全新 Office 2013 激活密钥 Office 2013 激活工具推荐
- 11-25正版 office 产品密钥 office 密钥 office2019 永久激活
- 11-22office2020破解版(附永久密钥) 免费完整版
- 11-302023 全新 office 2010 标准版/专业版密钥
- 03-262024最新最新office365激活密钥激活码永久有效