Thread: [Solved] 'Little fraction' stopped?
View Single Post
 
Old 01-30-2011, 03:45 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Mark,

The only in-built fractions in every font are ¼, ½ & ¾. Some fonts have support for thirds and eighths also, but anything else you have to create for yourself. And, whereas the in-built fractions consist of a single character, your own will consist of three or more characters. The following macro will convert your own fractions to an approximate visual representation of the in-built fraction characters. If you use it, I'd suggest not using the in-built fractions, so that the appearance is consistent throughout the document.
Code:
Sub Fraction()
Dim RngTmp As Range, StrFrac
With Selection
  StrFrac = Split(Selection.Text, "/")
  Set RngTmp = .Range
  With RngTmp
    .Font.Size = .Font.Size * 0.875
    .End = .Start + Len(StrFrac(0))
    .Font.Superscript = True
    .Characters.Last.Next.Font.Italic = True
    .End = .End + 2 + Len(StrFrac(1))
    .Start = .End - Len(StrFrac(1)) - 1
    .Font.Subscript = True
  End With
End With
Set RngTmp = Nothing
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote