我们的Notes部分允许对尾注使用非标准段落样式,当尾注中有多个段落时。例如,每个尾注设置如下:
我试图循环每一个音符来确定所使用的样式。如果第一段样式不是"Endnote Text“,则样式将更改为此默认样式。起作用了!如果存在下一个段落样式,则选中它以确定其样式名称。我希望允许使用"Endnote文本“以外的样式,但是使用"ActiveDocument.Endnotes(n).Range.Select”会导致所有样式都更改为"Endnote Text“。如何循环遍历所选尾注中的每个段落样式?
对于n=1到EndnoteCount ActiveDocument.Endnotes(n).Range.Select
CurrStyName = CurrSty.NameLocal
If Not (CurrStyName = "Endnote Text") The
CurrStyName = "Endnote Text"
ReportString = ReportString + vbNewLine + "The style " & CurrStyName & " is reverting to the default Endnote Text style for endnote#" + Str(n) + "."
End If
Set CurrSty2 = Selection.Next.ParagraphStyle..。
发布于 2020-08-07 13:06:08
ActiveDocument.Endnotes(n).Range包含尾注的所有段落,因此当您选择并应用样式时,将更改所有段落。
您需要做的是循环遍历尾注,然后遍历每个尾注的段落,,而不选择它们,如下所示:
Dim para As Long
For n = 1 To ActiveDocument.Endnotes.Count
With ActiveDocument.Endnotes(n).Range
For para = 1 To .Paragraphs.Count
CurrStyName = .Paragraphs(para).style.NameLocal
If Not (CurrStyName = "Endnote Text") Then
'do whatever you need here
End If
Next para
End With
Next nhttps://stackoverflow.com/questions/63301752
复制相似问题