生成一段VBA代码代码功能为在一个word文档中为包含字符:的段落修改段落格式格式为两端对齐、大纲级别为正文、左侧缩进0、右侧缩进0、悬挂缩进4字符
Sub FormatColonParagraphs()
Dim para As Paragraph
'Loop through all paragraphs in the active document
For Each para In ActiveDocument.Paragraphs
'Check if paragraph contains a colon
If InStr(para.Range.Text, ":") > 0 Then
'Set paragraph format
With para.Range.ParagraphFormat
.Alignment = wdAlignParagraphJustify
.OutlineLevel = wdOutlineLevelBodyText
.LeftIndent = 0
.RightIndent = 0
.FirstLineIndent = -4
End With
End If
Next para
End Sub
原文地址: https://www.cveoy.top/t/topic/rTo 著作权归作者所有。请勿转载和采集!