Thread: [Solved] Transfer text to footnotes
View Single Post
 
Old 02-12-2017, 06:16 PM
thiagoafdoria thiagoafdoria is offline Windows 8 Office 2016
Novice
 
Join Date: Feb 2017
Posts: 18
thiagoafdoria is on a distinguished road
Default Transfer text to footnotes

Hi!
I'm using a macro to transform every bit of green text in a document into footnotes. A person within the community of a software I use kindly shared the code to this macro. It's the followin one:

Quote:
Sub Makro8()
'
' Makro8 Makro
' Macro for MS Word converting parts of text in a special color (here: green)
' into MS Word footnotes
'
Do While Not ActiveDocument.Range.End - 1 = Selection.Range.End
Selection.Find.ClearFormatting
With Selection.Find
.Font.Color = wdColorGreen
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection.Font
.Color = wdColorAutomatic
End With
If Selection.Type = wdSelectionIP Then
If ActiveWindow.ActivePane.View.Type = wdPrintView Or ActiveWindow. _
ActivePane.View.Type = wdWebView Or ActiveWindow.ActivePane.View.Type = _
wdPrintPreview Then
ActiveWindow.View.SeekView = wdSeekFootnotes
Else
ActiveWindow.View.SplitSpecial = wdPaneFootnotes
End If
Exit Sub
End If
Selection.Cut
With ActiveDocument.Range(Start:=ActiveDocument.Content .Start, End:= _
ActiveDocument.Content.End)
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With
Selection.PasteAndFormat (wdPasteDefault)
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
ActiveWindow.ActivePane.Close
Loop
End Sub
The problem is, it transforms one part of the green text at a time. If I have 46 pieces of green text, I'd have to execute the macro 46 times. Do you have any idea of what I could modify in order to execute the macro only one time?
I'm running a Microsoft Word 2016 (Office 365) in Windows 8.1. Please note that the macro is working; it just doesn't transform the several pieces into footnotes all at once.
Best regards,
Thiago