Reply
 
Thread Tools Display Modes
  #1   Report Post  
WoodOne
 
Posts: n/a
Default Mixed fractions with sub/superscript formatting.

I type a great many mixed fractions (measurements). Sometimes WORD auto
formats fractions like 1/4 but not others like 9/16. How do I add
superscripts/subscript auto formating to these fractions so that 1 15/16 is
easier to read?
  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

On Sat, 24 Sep 2005 14:52:02 -0700, "WoodOne"
wrote:

I type a great many mixed fractions (measurements). Sometimes WORD auto
formats fractions like 1/4 but not others like 9/16. How do I add
superscripts/subscript auto formating to these fractions so that 1 15/16 is
easier to read?


See http://www.word.mvps.org/FAQs/Format...teFraction.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
  #3   Report Post  
Helmut Weber
 
Posts: n/a
Default

Hi Jay,

or something like this,
might be a possible extension to Suzanne's article.

Sub Macro7()
Dim l As Long ' length of expression found
Dim p As Long ' position of "/"
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Font.Position = 3 ' or a fraction of font size
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub

Dates could be excluded easily,
sure not expressions like 10 to the power of 1/13.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

  #4   Report Post  
Helmut Weber
 
Posts: n/a
Default

rdcm.select

was for testing only

Helmut Weber
  #5   Report Post  
WoodOne
 
Posts: n/a
Default

Dear Helmut: You're probably right but I have no idea what you are talking
about as I'm no programmer. I'm a woodworker who writes a lot of
instructional material that includes many fractional dimensions--I'd just
like to type in 1/2's, 1/4's, 8th's, 16th's, 32nd's, and 64th's and have them
all appear the same without jumping through hoops. I'll play around a bit
with auto correct but I don't have the time or patience to write a line of
code everytime I need a fraction. But thanks for the input--it keeps me on
top of just how much I need to learn.

"Helmut Weber" wrote:

Hi Jay,

or something like this,
might be a possible extension to Suzanne's article.

Sub Macro7()
Dim l As Long ' length of expression found
Dim p As Long ' position of "/"
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Font.Position = 3 ' or a fraction of font size
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub

Dates could be excluded easily,
sure not expressions like 10 to the power of 1/13.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




  #6   Report Post  
Graham Mayor
 
Posts: n/a
Default

There is a variety of possibilities - see:

http://www.gmayor.com/createfraction.htm
or
http://gregmaxey.mvps.org/Formatted_Fractions.htm
or
http://www.word.mvps.org/FAQs/Format...teFraction.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


WoodOne wrote:
Dear Helmut: You're probably right but I have no idea what you are
talking about as I'm no programmer. I'm a woodworker who writes a
lot of instructional material that includes many fractional
dimensions--I'd just like to type in 1/2's, 1/4's, 8th's, 16th's,
32nd's, and 64th's and have them all appear the same without jumping
through hoops. I'll play around a bit with auto correct but I don't
have the time or patience to write a line of code everytime I need a
fraction. But thanks for the input--it keeps me on top of just how
much I need to learn.

"Helmut Weber" wrote:

Hi Jay,

or something like this,
might be a possible extension to Suzanne's article.

Sub Macro7()
Dim l As Long ' length of expression found
Dim p As Long ' position of "/"
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Font.Position = 3 ' or a fraction of font size
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub

Dates could be excluded easily,
sure not expressions like 10 to the power of 1/13.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"



  #7   Report Post  
Helmut Weber
 
Posts: n/a
Default

Hi WoodOne,

actually, I've tried to address Jay Freedman.

But since you are writing,

I'll play around a bit with auto correct
but I don't have the time or patience to write
a line of code everytime I need a fraction.
But thanks for the input--it keeps me on
top of just how much I need to learn. !!!


I think, you might still be interested,
and not know yet, how simple it can be.
Sure, only in a way. ;-)

There was I time, when I didn't know
how to insert a floppy disc ito a disc drive.

You need to know nothing about programming,
therefore there are no comments in the code.

Get to the VBA-Editor: [alt F11].
Copy the code from the posting into it.
Close it. Assign a shortcut to "Fractions",
by the menu "Tools", "Customize".
Click on "Keyboard".
Select "Macros" in the left listbox.
Select "Fractions" in the right listbox.
Click in "Press new shortcut key".
Press e.g. [F12]. Click "assign".
....
You will have to press F12 every now and then.

Maybe there is someone around, to help you,
with the VBA-Editor and assigning a shortcut.

Sub Fractions()
Dim l As Long
Dim p As Long
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
Dim h As Long
h = Selection.Start
ResetSearch
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
If rDcm.Next "/" Then
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8
rDcm.Font.Position = 3
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8
rDcm.Collapse Direction:=wdCollapseEnd
End If
Wend
End With
ResetSearch
ActiveDocument.Characters(h).Select
Selection.Collapse Direction:=wdCollapseEnd
End Sub
' ---
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub

Don't give up.

--
Greetings from a bavarian hobby woodworker

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
















  #8   Report Post  
WoodOne
 
Posts: n/a
Default

Dear Helmut: I appreciate your time and I'll certainly be playing around
with this a bit . . . but not on your level of expertise 'til next month (or
a little later) as this month I'm getting ready for a toy production (some
300 toys over a weekend with 25-30 people involved). Thanks again for your
input and happy woodworking!

"Helmut Weber" wrote:

Hi WoodOne,

actually, I've tried to address Jay Freedman.

But since you are writing,

I'll play around a bit with auto correct
but I don't have the time or patience to write
a line of code everytime I need a fraction.
But thanks for the input--it keeps me on
top of just how much I need to learn. !!!


I think, you might still be interested,
and not know yet, how simple it can be.
Sure, only in a way. ;-)

There was I time, when I didn't know
how to insert a floppy disc ito a disc drive.

You need to know nothing about programming,
therefore there are no comments in the code.

Get to the VBA-Editor: [alt F11].
Copy the code from the posting into it.
Close it. Assign a shortcut to "Fractions",
by the menu "Tools", "Customize".
Click on "Keyboard".
Select "Macros" in the left listbox.
Select "Fractions" in the right listbox.
Click in "Press new shortcut key".
Press e.g. [F12]. Click "assign".
....
You will have to press F12 every now and then.

Maybe there is someone around, to help you,
with the VBA-Editor and assigning a shortcut.

Sub Fractions()
Dim l As Long
Dim p As Long
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
Dim h As Long
h = Selection.Start
ResetSearch
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
If rDcm.Next "/" Then
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8
rDcm.Font.Position = 3
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8
rDcm.Collapse Direction:=wdCollapseEnd
End If
Wend
End With
ResetSearch
ActiveDocument.Characters(h).Select
Selection.Collapse Direction:=wdCollapseEnd
End Sub
' ---
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub

Don't give up.

--
Greetings from a bavarian hobby woodworker

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

















  #9   Report Post  
WoodOne
 
Posts: n/a
Default

Graham: Thanks for the information. I've checked two of the sites you
provided and they seem to have information that is certainly a good start.
As I mentioned to Helmut I've got a full plate the next couple of weeks so I
doubt I'll be back to it right away . . . but this has been a frustrating
problem for some time so I'm very appreciative of the information. Thanks
again.

"Graham Mayor" wrote:

There is a variety of possibilities - see:

http://www.gmayor.com/createfraction.htm
or
http://gregmaxey.mvps.org/Formatted_Fractions.htm
or
http://www.word.mvps.org/FAQs/Format...teFraction.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


WoodOne wrote:
Dear Helmut: You're probably right but I have no idea what you are
talking about as I'm no programmer. I'm a woodworker who writes a
lot of instructional material that includes many fractional
dimensions--I'd just like to type in 1/2's, 1/4's, 8th's, 16th's,
32nd's, and 64th's and have them all appear the same without jumping
through hoops. I'll play around a bit with auto correct but I don't
have the time or patience to write a line of code everytime I need a
fraction. But thanks for the input--it keeps me on top of just how
much I need to learn.

"Helmut Weber" wrote:

Hi Jay,

or something like this,
might be a possible extension to Suzanne's article.

Sub Macro7()
Dim l As Long ' length of expression found
Dim p As Long ' position of "/"
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "[0-9]{1,}/[0-9]{1,}"
.MatchWildcards = True
While .Execute
p = InStr(rDcm.Text, "/")
l = Len(rDcm.Text)
rDcm.End = rDcm.Start + p - 1
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Font.Position = 3 ' or a fraction of font size
rDcm.Start = rDcm.Start + p
rDcm.End = rDcm.End + l - p
rDcm.Select
rDcm.Font.Size = 8 ' or a fraction of font size
rDcm.Collapse Direction:=wdCollapseEnd
Wend
End With
End Sub

Dates could be excluded easily,
sure not expressions like 10 to the power of 1/13.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make odd fractions look like normal common fractions? Skimap1 Microsoft Word Help 2 July 20th 05 03:13 PM
?remove all formatting from emailed course manual Colleen New Users 0 June 23rd 05 03:54 PM
Word should auto convert the 1/3 fractions like 1/4-1/2 fractions. greneyes Microsoft Word Help 5 March 24th 05 07:31 PM
Form Fields lose bold formatting Ellen Microsoft Word Help 0 February 17th 05 09:11 PM
Apply Style but keep direct formatting? Stefan Blom New Users 2 November 28th 04 11:30 PM


All times are GMT +1. The time now is 04:00 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"