I’ve been trying to write a simple macro for Word 2010 to delete a tab on either side of a footnote number. I have huge numbers of files that come in with these and they have to be deleted before I format them.
Here is what I have so far. What I can’t figure out is how is to make it remove all of them in one swoop, instead of just the first one:
Sub ReplaceTabsInNotes()
Selection.GoTo What:=wdGoToFootnote, Which:=wdGoToFirst, Count:=1, Name:= _
“”
With Selection.Find
On Error Resume Next
.Text = vbTab + “^f”
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
While Selection = vbTab
Selection.Delete
Selection.Find.Execute
Wend
Selection.Find.Execute
End With
ActiveDocument.UndoClear
Selection.GoTo What:=wdGoToFootnote, Which:=wdGoToFirst, Count:=1, Name:= _
“”
With Selection.Find
On Error Resume Next
.Text = “^f” = vbTab
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
While Selection = vbTab
Selection.Delete
Selection.Find.Execute
Wend
End With
ActiveDocument.UndoClear
End Sub
Thanks in advance for any help you can give.