A
andreas
Dear Experts:
Below macro copies all footnotes and pastes them into a new document.
The macro runs just fine. There is a small drawback to the pasted text
since the original footnote reference numbers are lost and all the
pasted footnotes have got the number 1. I do not care about that.
Now I got a document where each time a new section is started, the
footnotes will start with number one (1) again.
The macro should be rewritten so that whenever the footnote number
restarts, the target document in which the footnotes are copied should
list the new section number before the copied footnotes. Example:
Section 1:
(1) sample text 1
(1) sample text 2
(1) sample text 3
Section 2
(1) sample footnote text 4
(1) sample footnote text 5
(1) sample footnote text 6
(1) sample footnote text 7
Section 3
(1) sample footnote text 8
etc.
I wonder whether this is possible? Help is much appreciated. Thank you
very much in advance.
Regards, Andreas
Sub CopyFNTextInNewDoc()
If MsgBox("This macro copies all footnotes and paste them into a new
document" & vbCrLf & _
"Would you like to continue?", vbYesNo, "Copying all footnotes into a
new document") = vbNo Then
Exit Sub
ElseIf ActiveDocument.Footnotes.count = 0 Then
MsgBox "There are no footnotes in the current document", vbInformation
End If
Dim oDoc As Document, nDoc As Document
Set oDoc = ActiveDocument
Set nDoc = Documents.Add(Template:=oDoc.AttachedTemplate.FullName)
nDoc.Content.FormattedText = oDoc.StoryRanges
(wdFootnotesStory).FormattedText
End Sub
Below macro copies all footnotes and pastes them into a new document.
The macro runs just fine. There is a small drawback to the pasted text
since the original footnote reference numbers are lost and all the
pasted footnotes have got the number 1. I do not care about that.
Now I got a document where each time a new section is started, the
footnotes will start with number one (1) again.
The macro should be rewritten so that whenever the footnote number
restarts, the target document in which the footnotes are copied should
list the new section number before the copied footnotes. Example:
Section 1:
(1) sample text 1
(1) sample text 2
(1) sample text 3
Section 2
(1) sample footnote text 4
(1) sample footnote text 5
(1) sample footnote text 6
(1) sample footnote text 7
Section 3
(1) sample footnote text 8
etc.
I wonder whether this is possible? Help is much appreciated. Thank you
very much in advance.
Regards, Andreas
Sub CopyFNTextInNewDoc()
If MsgBox("This macro copies all footnotes and paste them into a new
document" & vbCrLf & _
"Would you like to continue?", vbYesNo, "Copying all footnotes into a
new document") = vbNo Then
Exit Sub
ElseIf ActiveDocument.Footnotes.count = 0 Then
MsgBox "There are no footnotes in the current document", vbInformation
End If
Dim oDoc As Document, nDoc As Document
Set oDoc = ActiveDocument
Set nDoc = Documents.Add(Template:=oDoc.AttachedTemplate.FullName)
nDoc.Content.FormattedText = oDoc.StoryRanges
(wdFootnotesStory).FormattedText
End Sub