View Single Post
  #4   Report Post  
Venky62 Venky62 is offline
Junior Member
 
Posts: 19
Default

Sorry about that. You are right. The code I gave you only transposes superscripts. It does not work with footnote references.

The ^f cannot be used with wildcards. But why would you want a wildcard? If the aim is to locate all footnotes, then ^f does that. So I have used the ^f in the Word Search and Replace using code and after selecting the footnote reference mark, it is just a matter of cutting and pasting it after the next character.

The code below will work if there are no spaces between the footnote reference mark and the next character ("." or ","). If there may or may not be spaces, then the code has to be modified. But it can be done.

Also, this code searches the whole document and transposes all the footnote reference marks it finds. If some footnote references are in the correct position and some are not, then this code will have to be modified further.

I have tested it and it works, but with the above conditions. If you want it to be more foolproof, please let me know. Or you may work it out yourself.

Sub TransposeFootnote()
'

'Move to top of document

Selection.HomeKey Unit:=wdStory, Extend:=wdMove


'search whole document

Do Until ActiveDocument.Bookmarks("\Sel").Range.End = _
ActiveDocument.Bookmarks("\EndOfDoc").Range.End

'search for footnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^f"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With

Selection.Find.Execute

'transpose footnote
If Selection.Find.Found = True Then

With Selection
'cuts the footnote and pastes it after the next character.
'This assumes that there are no spaces between footnote reference mark and the next character
.Cut
.Collapse
.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove
.PasteAndFormat wdFormatOriginalFormatting
'delete the extra space produced by cut and paste
.MoveLeft Unit:=wdCharacter, Count:=1
.MoveStart Unit:=wdCharacter, Count:=-1
.Delete
'move cursor beyond the transposed footnote so as to search for the next
.MoveRight Unit:=wdCharacter, Count:=2

End With
Else
Exit Sub
End If

Loop

End Sub

Quote:
Originally Posted by Peter T. Daniels View Post
Thank you, and did you test it? It doesn't appear to refer to the
special nature of a footnote reference, as opposed to simply dealing
with Superscript format.

Can you point to exactly what the modifications are, so that I can
make just those changes, as opposed to replacing the whole thing and
then maybe having to go back to the earlier version? (I see 7 lines, 2
+ 5, set off near the end.)

[/i][/color][/i][/color]