此题要求与有别于索引的目的,但又不似目录。我只是以VBA的角度做了一个,供楼主参考: '* +++++++++++++++++++++++++++++ '* Created By SHOUROU@ExcelHome 2006-9-5 5:25:17 '仅测试于System: Windows NT Word: 11.0 Language: 2052 '№ 0067^The Code CopyIn [ThisDocument-ThisDocument]^' '* ----------------------------- Option Explicit
Sub GetIndexList() Dim oField As Field, myString As String Dim myRange As Range Dim myArray() As String, temp As String Application.ScreenUpdating = False With ActiveDocument For Each oField In .Fields With oField If .Type = wdFieldIndexEntry Then myArray = VBA.Split(VBA.Replace(.Code.Text, " ", ""), "\") temp = myArray(0) temp = VBA.Replace(temp, "XE", "") temp = VBA.Replace(temp, """", "") .Select myString = myString & temp & vbTab & Selection.Range.ListFormat.ListString & vbCrLf End If End With Next .Content.InsertAfter Chr(13) & Chr(12) Set myRange = .Range(.Content.End - 1, .Content.End - 1) myRange.InsertAfter myString myRange.ParagraphFormat.TabStops.Add Position:=Word.CentimetersToPoints(21 - 3.17 * 2), Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots End With Application.ScreenUpdating = True End Sub '----------------------
|