下面的宏发布了here并插入" Page#。"在每个尾注之前:
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
对于带有上标的文本
Yak yak yak yak yak yak.^1
:
:
Yuk yuk yuk yuk yuk yuk yuk.^2
宏转换来自
的尾注^1 Blah blah blah
^2 Blah blah blah
进入
^1 Page 22. Blah blah blah
^2 Page 119. Blah blah blah
我现在想添加被引用的句子。所以
^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
我在几本非小说类书籍中看到了这一点。在宏中可以吗?
答案 0 :(得分:1)
你走了。
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