Easy way to change all document reference system

V

Vladimir.Bayda

Hello,

I have a large MS Word document with next bibliography reference
system:

1. Pages contain text with references on footnotes;
2. All footnotes looks like:
number_of_footnote_on_page book or article description, p.
page_number
number_of_footnote_on_page see previous book or article, p.
page_number
.....

I need reference system like next:
[book_number, p. page_number] - regular text in document instead
footnote references,
and all books list with numbers at the end of document.
 
P

Pesach Shelnitz

Hi Vladimir,

Word 2007 has a new bibliography feature, which is more suitable for
maintaining a bibliography in a document than my solution. However, the new
feature does not seem to be able to reproduce the result that you requested.

My solution makes the changes that you asked for as I understand them. Since
it uses bookmarks and field codes, it is possible to add additional sources
to the list in the bibliography and references to them without destroying the
numbering by adding similar bookmarks and field codes.

Sub ConvertFootnotes()
Dim myArray As Variant
Dim myField As Field
Dim fnt As Footnote
Dim fntText As String
Dim srcDesc As String
Dim i As Integer
Dim j As Integer
Dim k As Long

Selection.HomeKey wdStory
j = 0
With ActiveDocument
If .Footnotes.Count = 0 Then
MsgBox "There are no footnotes in this document."
Exit Sub
End If
ReDim myArray(1 To .Footnotes.Count) As String
For i = 1 To .Footnotes.Count
Selection.GoToNext wdGoToFootnote
Selection.MoveRight Unit:=wdWord, Count:=1
fntText = .Footnotes(i).Range.Text
k = InStr(1, fntText, "Same as previous")
If k = 0 Then
j = j + 1
myArray(j) = fntText
End If
Selection.TypeText Text:="["
Set myField = .Fields.Add(Range:=Selection.Range, _
Type:=wdFieldEmpty, PreserveFormatting:=False)
myField.Code.Text = "REF src" & CStr(j)
myField.Select
Selection.Collapse Direction:=wdCollapseEnd
k = InStr(1, fntText, ", p")
If k <> 0 Then
Selection.InsertAfter Right(fntText, Len(fntText) - k + 1) &
"]"
Else
Selection.InsertAfter "]"
End If
Next
For Each fnt In .Footnotes
fnt.Delete
Next
.Bookmarks("\EndOfDoc").Select
Selection.TypeText Text:="BIBLIOGRAPHY" & vbCrLf
For i = 1 To j
srcDesc = myArray(i)
k = InStr(1, srcDesc, ", p")
If k <> 0 Then
srcDesc = Left(srcDesc, k - 1)
End If
.Bookmarks.Add name:="src" & CStr(i), Range:=Selection.Range
Set myField = .Fields.Add(Range:=Selection.Range, _
Type:=wdFieldEmpty, PreserveFormatting:=False)
myField.Code.Text = "SEQ srcs"
myField.Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.TypeText Text:=". " & srcDesc & vbCrLf
.Bookmarks("src" & CStr(i)).End = .Bookmarks("src" &
CStr(i)).Start + 8
Next
.Fields.Update
End With
Set myField = Nothing
End Sub

--
Hope this helps,
Pesach Shelnitz


Hello,

I have a large MS Word document with next bibliography reference
system:

1. Pages contain text with references on footnotes;
2. All footnotes looks like:
number_of_footnote_on_page book or article description, p.
page_number
number_of_footnote_on_page see previous book or article, p.
page_number
.....

I need reference system like next:
[book_number, p. page_number] - regular text in document instead
footnote references,
and all books list with numbers at the end of document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top