我正在尝试在自动生成的Word文档中的一个段落之前添加空格。我只需要在该特定段落的第一行之前留出空格。问题是第一个空白行之后的下一行。
With Wapp
With .Selection
.TypeParagraph
'Add line spacing
.ParagraphFormat.SpaceBefore = 0
.ParagraphFormat.SpaceAfter = 0
.TypeText St1
.TypeParagraph
.ParagraphFormat.SpaceBefore = 36
.BoldRun
'Centers text
.ParagraphFormat.Alignment = 1
.TypeText St2
.BoldRun
.ParagraphFormat.SpaceBefore = 0
.TypeText VBA.vbNewLine
.TypeText St3
.TypeText VBA.vbNewLine
.ParagraphFormat.Alignment = 1
End With
End With
With Wapp
With .Selection
.TypeParagraph
'Add line spacing
.ParagraphFormat.SpaceBefore = 0
.ParagraphFormat.SpaceAfter = 0
.TypeText St1
.TypeParagraph
'Starts spacing
.ParagraphFormat.SpaceBefore = 6
.BoldRun
'Centers text
.ParagraphFormat.Alignment = 1
.TypeText St2
.BoldRun
.TypeText VBA.vbNewLine
'Ends spacing
.ParagraphFormat.SpaceBefore = 0
.TypeText St3
.TypeText VBA.vbNewLine
.ParagraphFormat.Alignment = 1
End With
End With
您可以使用以下行为当前段落创建1英寸(72点)的第一行缩进:
.ParagraphFormat.FirstLineIndent = Application.InchesToPoints(1)