#1
|
|||
|
|||
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. ()
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 ---------- Sorry for my clumsy English language ; please ask if I'm not clear enough |
#2
|
|||
|
|||
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 |
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 |
Can I bring contents of slide step-by-step | yabi | PowerPoint | 1 | 12-17-2011 03:13 AM |
Finding a problem font | RickRS | Word | 5 | 10-14-2011 05:35 PM |