[英]How to insert a sentence preceding endnote superscript into endnote
The macro below was posted here and inserts "Page #."下面的宏被张贴在这里并插入“页号”。 preceding each endnote:
在每个尾注之前:
Sub InsertPageNumberForEndnotes()
Dim endNoteCount As Integer
Dim curPageNumber As Integer
If ActiveDocument.Endnotes.Count > 0 Then
For endNoteCount = 1 To ActiveDocument.Endnotes.Count
Selection.GoTo What:=wdGoToEndnote, Which:=wdGoToAbsolute, _
Count:=endNoteCount
curPageNumber = Selection.Information(wdActiveEndPageNumber)
ActiveDocument.Endnotes(endNoteCount).Range.Select
ActiveDocument.Application.Selection.Collapse _
(WdCollapseDirection.wdCollapseStart)
ActiveDocument.Application.Selection.Paragraphs(1).Range.Characters(3)._
InsertBefore "Page " & CStr(curPageNumber) & ". "
Next
End If
End Sub
So for text with superscripts所以对于带有上标的文本
Yak yak yak yak yak yak.^1
:
:
Yuk yuk yuk yuk yuk yuk yuk.^2
The macro converts endnotes from宏将尾注从
^1 Blah blah blah
^2 Blah blah blah
Into进入
^1 Page 22. Blah blah blah
^2 Page 119. Blah blah blah
I'd now like add the sentence being referenced.我现在想添加被引用的句子。 So
所以
^1 Page 22. Yak yak yak yak yak yak. Blah blah blah
^2 Page 119. Yuk yuk yuk yuk yuk yuk yuk. Blah blah blah
I see this done in several non-fiction books.我在几本非小说类书籍中看到了这一点。 Is it possible in a macro?
在宏中可以吗?
Here you go.给你。
Sub AddSourceToEndNote()
' 04 Oct 2017
Dim Note As EndNote
Dim Txt As String, Tmp As String
With ActiveDocument
If .EndNotes.Count Then
For Each Note In .EndNotes
With Note
With .Reference
Txt = "Page" & Format(.Information(wdActiveEndPageNumber), " 0. ")
Tmp = .Sentences(1).Text
Do While Asc(Right(Tmp, 1)) < 31
Tmp = Left(Tmp, Len(Tmp) - 1)
If Len(Tmp) < 1 Then Exit Do
Loop
If InStr(".:?!", Right(Tmp, 1)) = 0 Then Tmp = Tmp & "."
Txt = Txt & Tmp
End With
With .Range
.Text = Txt & " " & .Text
End With
End With
Next Note
End If
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.