How to replace all superscript characters to footnotes?

A

avkokin

Hello.
There is one document which has some words with last characters which
look as superscript (1, 2,3 etc.).
How to replace all superscript characters to footnotes? And if between
word and superscript has space?
Thank you.
 
A

avkokin

That what I did,but it not works correct:

Sub subscript_to_footnotes()
'superscript to footnotes
Dim rText As Range
Dim fn As Footnote
Dim i As Long

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findtext:="[0-9]{1;}", _
MatchWildcards:=True, _
Wrap:=wdFindStop, Format:=True, Forward:=True) = True
Set rText = Selection.Range
rText.MoveEnd wdCharacter, -1
??????????
Loop
End With
End With
End Sub
 
S

StevenM

To: A. V. Kokin,

Sub Superscript2Footnote()
Dim oRange As Range
Dim fn As Footnote

Set oRange = ActiveDocument.Range
With oRange.Find
.ClearFormatting
.Forward = True
.Format = True
.Wrap = wdFindStop
.Font.Superscript = True
.Execute

While .Found
oRange.Delete
Set fn = ActiveDocument.Footnotes.Add(oRange)
oRange.Move wdWord, 1
.Execute
Wend
End With
MsgBox ActiveDocument.Footnotes.count
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top