ms-word - 更改脚注的顺序
问题描述
我想更改文本中的脚注。更具体地说,我想在这个概念中的脚注之后加上句号。在线似乎唯一的解决方案是使用宏,但我不知道从哪里开始。
我只发现这个脚本接近解决方案
Sub UpdateFootnotes()
'Update fields in all footnotes.
Dim doc As Document
Dim rng As Range
Set doc = ActiveDocument
If doc.Footnotes.Count <> 0 Then
'Select all footnotes.
Set rng = doc.Footnotes(1).Range
rng.WholeStory
rng.Select
'Update all fields.
Selection.Fields.Update
End If
End Sub
我需要为我的学士论文做这件事,它真的对我有很大帮助!
编辑:来自微软论坛中发布的答案here
解决方案
您找到的宏与更改脚注引用的位置无关;它只是更新脚注中的任何字段。
以下宏处理脚注和尾注。
Sub FootnoteEndnoteFix()
Application.ScreenUpdating = False
Dim FtNt As Footnote, EndNt As Endnote, Rng As Range
With ActiveDocument
For Each FtNt In .Footnotes
Set Rng = FtNt.Reference
With Rng
'Eliminate any spaces before the footnote
While .Characters.First.Previous.Text = " "
.Characters.First.Previous.Text = vbNullString
Wend
'Swap the footnote/punctuation, as applicable
Select Case .Characters.First.Previous
Case ".", ",", "!", "?", ":", ";"
.InsertAfter .Characters.First.Previous
.Characters.First.Previous.Text = vbNullString
.Characters.Last.Font.Superscript = False
End Select
End With
Next
For Each EndNt In .Endnotes
Set Rng = EndNt.Reference
With Rng
'Eliminate any spaces before the endnote
While .Characters.First.Previous.Text = " "
.Characters.First.Previous.Text = vbNullString
Wend
'Swap the endnote/punctuation, as applicable
Select Case .Characters.First.Previous
Case ".", ",", "!", "?", ":", ";"
.InsertAfter .Characters.First.Previous
.Characters.First.Previous.Text = vbNullString
.Characters.Last.Font.Superscript = False
End Select
End With
Next
End With
Application.ScreenUpdating = True
End Sub
推荐阅读
- java - 获取随机按钮并设置特定值
- java - 如何将 json 数据从主报表传递到子报表 Jaspersoft Studio
- sqlite - 在连接 sqlite 的表时包括一个表中的值总和
- java - build.xml fx:association 抛出 NullPointerException
- visual-studio - 从 GitHub.com 克隆 VS 项目并将其作为文件结构加载到 VS 中,而不是 VS 项目
- php - WordPress PHP 和 PHP 到 JSON 编码的数组
- r - 基于R中的另一个数据框在数据框中查找值
- arrays - 从 csv 文件创建对象数组的问题
- mysql - Laravel 6 - 更新模型时间戳
- python - 从两个一维向量 a、b 和 A[i,j] 创建一个布尔数组 A,如果 a[i]==b[j]