# how to select all footnotes with a macro?

Consider you received a word savagely formatted document, and you have to clean it. Footnotes are styled as various different paragraph styles. You need to select them all and apply the footnote paragraph style. Solutions using "Alternative find & replace" extension don't help, as they depend on the correct paragraph styling to work. I guess it should be extremely easy to write a macro to do so, but I don't have a clue (I'm a designer, not a programmer). I record some macros, but as there is no "select all footnotes" command, I'm helpless. Can anyone assist me?

edit retag close merge delete

Sort by » oldest newest most voted

AltSearch can do this, as explained in the help.

Using [::Footnote::]\\ with the button [ Find all ], the text of all FNs will be selected (handy for assigning a paragraph style to all FNs at once)

Your question states that this didn't work for you because it "depend[s] on the correct paragraph styling," but I don't see why, because it works no matter what the paragraph style is.

If for some reason that doesn't work, the following code from Listing 7.24 of Andrew's Macro Document gives an idea of how to work with footnotes.

fnotes=xdoc.getFootNotes()
If fnotes.hasElements() Then
fnotecount=0
For nfnotes=0 To fnotes.getCount()-1
thisnote=fnotes.getbyIndex(nfnotes)
startcursor=thisnote.getStart()


Since you are "a designer, not a programmer," this is probably not something you want to try. So you may want to find someone who can write the macro for you.

Or, unzip the .odt file and edit content.xml with a good text editor, possibly using regular expressions. When you are finished making the corrections, zip the file back up again.

more