I would like to find a number between two hashtags, delete the hashtags and format the number that was between the hashtags as subscript.
Example: The text ##12##
should be converted to 12
.
Here is my code so far:
Public Sub SubscriptText()
With Selection.Find
.ClearFormatting
.Text = "##"
.Replacement.ClearFormatting
.Replacement.Text = "##"
.Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
End With
End Sub
This removes the ##
, but how do I format the number as subscript?
I would do this: look for the end of the opening hashtag, and the start of the closing hashtag. Everything between those two positions is presumably a number for which you want to change the font.
This worked for me: