kerrypnx
4/16/2018 - 9:33 AM

Chicago footnote第二步

Chicago footnote第二步

Sub Footnote2Reference2()
'Call layout_search_replace.jump_to_reference_section
Dim refR As Range
Set refR = ActiveDocument.Range(selection.Range.Start, ActiveDocument.Range.End)
refR.Select
With selection.Find
    .Text = "^13[0-9]{1,}\. "
    .MatchWildcards = True
    .Wrap = wdFindStop
    .ClearFormatting
    .Replacement.ClearFormatting
    Do
    .Execute
    Dim myrange As Range
    If .Found Then
    Set myrange = ActiveDocument.Range(selection.Range.Start + 1, selection.Range.End)
'    myrange.Cut
'    selection.MoveDown wdParagraph, 2
'    selection.MoveLeft wdCharacter, 1
'    selection.Paste
myrange.Delete
selection.collapse wdCollapseEnd
    End If
    If Not .Found Then
    Exit Do
    End If
    Loop
End With

Call aAdd_authorName_year '回调nameYear

refR.HighlightColorIndex = 0

Dim i As Integer
For i = 1 To refR.Paragraphs.count
Call layout_search_replace.jump_to_reference_section

selection.MoveDown wdParagraph, i
selection.MoveRight wdCharacter, 1 + InStr(selection.Paragraphs(1).Range, ")"), wdExtend
selection.Cut
selection.HomeKey wdStory
With selection.Find
    .Text = "[" & i & "]"
    .Highlight = True
    .Wrap = wdFindStop
    Do
    .Execute
    If Not .Found Then
    Exit Do
    End If
    If .Found Then
    selection.PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
    selection.collapse wdCollapseEnd
    
    End If
    Loop
End With

Next i
End Sub