下面的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英寸
IT时代网(关注微信公众号ITtime2000,定时推送,互动有福利惊喜)所有原创文章版权所有,未经授权,转载必究。
创客100创投基金成立于2015年,直通硅谷,专注于TMT领域早期项目投资。LP均来自政府、互联网IT、传媒知名企业和个人。创客100创投基金对IT、通信、互联网、IP等有着自己独特眼光和丰富的资源。决策快、投资快是创客100基金最显著的特点。
小何
小何
小何
小何