View Single Post
 
Old 07-13-2017, 11:14 AM
iwonder iwonder is offline Windows 10 Office 2013
Novice
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default Finding raised characters by 0.5 pt step (Font.Position pb)

Hello

I've found the following code by Dave Lett, (thanks to him!) in a Google group for which I don't want to subscribe. ()
  • It converts font raised characters (Ctrl+D, then advanced tab etc.) to true SuperScript numbers. That's what I need for now.

That code works fine for characters raised by an integer number of points. eg: 1, 2, 3, etc.
But it doesn't work for non-integer numbers 1.5, 2.5, 3.5 etc.

This is strange !

How to adapt the code to accept non-integer numbers ?
Help would be greatly appreciated here !

Code:
Sub RAISED_TO_SUPERSCRIPT()
With Selection
    .HomeKey unit:=wdStory
' how many loops you do depends on the max
' value you think the font might be raised
For i = 1 To 10
    With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = ""
        .Font.Position = i
        With .Replacement
            .Text = ""
            .Font.Position = 0
            .Font.Size = 11.5 ' I, (iwonder) added this to get a normal font size
            .Font.Superscript = True
        End With
        .Execute Replace:=wdReplaceAll
    End With
Next i
End With
End Sub
PS: are I don't know if it's important, but in my non-english Word version, accepted values to raise the font are like this : 1,5 2,5 etc. (with commas instead of a period/dot)
----------
Sorry for my clumsy English language ; please ask if I'm not clear enough
Reply With Quote