Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2017, 11:14 AM
iwonder iwonder is offline Finding raised characters by 0.5 pt step (Font.Position pb) Windows 10 Finding raised characters by 0.5 pt step (Font.Position pb) Office 2013
Novice
Finding raised characters by 0.5 pt step (Font.Position pb)
 
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
  #2  
Old 07-14-2017, 07:57 AM
iwonder iwonder is offline Finding raised characters by 0.5 pt step (Font.Position pb) Windows 10 Finding raised characters by 0.5 pt step (Font.Position pb) Office 2013
Novice
Finding raised characters by 0.5 pt step (Font.Position pb)
 
Join Date: Jun 2017
Location: France
Posts: 10
iwonder is on a distinguished road
Default

After deeper internet search it seems that in 2007 that was impossible with pure VBA code.

"When the macro language changed from WordBasic to VBA, the developpers
messed up and defined the position as a Long (integer), although half points
are allowed."

And I think it is the same now in 2017.

Luckily, it can be bypassed with pieces of WordBasic code that can be inserted in the VBA macro code:

Code:
With WordBasic
.EditFindClearFormatting
.EditReplaceClearFormatting
.EditFindClearFormatting
.EditFindFont Position:="4.5"
.EditReplaceFont Superscript:=True
.EditReplace Format:=1, Wrap:=1, ReplaceAll:=True
End With
Reply With Quote
Reply

Tags
conversion, fake superscript, true superscript



Similar Threads
Thread Thread Starter Forum Replies Last Post
full font characters not appearing immediately Nayan Nepal Excel 0 06-28-2016 07:02 AM
Finding a word or phrase in a fiction book's prose without searching characters’ dialogue Rob_001 Word 10 10-26-2015 12:41 PM
Increase Sentence Font at cursor position ilcaa72 Word VBA 8 02-20-2014 08:40 AM
Finding raised characters by 0.5 pt step (Font.Position pb) Can I bring contents of slide step-by-step yabi PowerPoint 1 12-17-2011 03:13 AM
Finding raised characters by 0.5 pt step (Font.Position pb) Finding a problem font RickRS Word 5 10-14-2011 05:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft