Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-18-2012, 04:01 PM
macropod's Avatar
macropod macropod is offline Fraction macro not working Windows 7 64bit Fraction macro not working Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
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

perhaps you'd prefer mine:
Code:
Sub Fraction()
Dim RngTmp As Range, StrFrac
With Selection
  If InStr(.Text, "/") < 2 Then GoTo ErrMsg
  While Not .Characters.Last.Text Like "[0-9]"
    .End = .End - 1
    If .Start + InStr(.Text, "/") = .End Then GoTo ErrMsg
  Wend
  While Not .Characters.First.Text Like "[0-9]"
    .Start = .Start + 1
    If .Start = .End Or InStr(.Text, "/") = 0 Then GoTo ErrMsg
  Wend
  StrFrac = Split(.Text, "/")
  Set RngTmp = .Range
  With RngTmp
    .Font.Size = Round(.Font.Size * 1.75) / 2
    .End = .Start + Len(StrFrac(0))
    .Font.Superscript = True
    .Characters.Last.Next.Font.Italic = True
    .End = Selection.End
    .Start = .Start + InStr(.Text, "/")
    .Font.Subscript = True
  End With
End With
Set RngTmp = Nothing
Exit Sub
ErrMsg:
MsgBox "No fraction selected!", vbCritical, "Format Fraction"
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fraction macro not working macro not working (on click increment) gsrikanth Excel Programming 1 07-12-2012 07:40 AM
Fraction macro not working 'Little fraction' stopped? markg2 Word 5 01-31-2011 01:58 PM
Macro to open template not working Brandi Mail Merge 2 06-24-2010 09:29 AM
fraction not appearing correctly kcr Word 1 10-21-2009 03:51 PM
Word 2000 Macro not working properly brianlb Word VBA 1 07-01-2009 07:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:14 PM.


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