making fractions in word

M

MikeR-Oz

I have tried to follow this
:-http://www.techtv.com/screensavers/windowstips/story/0,24330,3390846,00.ht
ml


In order to chnge my fraction 2/3 into correct format 2 (numerator) over the
3 ( denominator) but I cannot seem to get it right.

Any suggestions with what I have done wrong with the links method or is
there another way?

tools\autocorrect\replace: box - has(x/y) and next to it inn the with: box
'x' over 'y' i.e the 'x' is on top with a line below and then 'y' below the
line.
In the lines below these boxes there are the line (x/y) * eq \f(x,y)*

What have I done wrong as I then type say 5/10 and it should change it
automatically in the new form! But it doesnt work?!

Thanks
Mike
 
M

MikeR-Oz

Looking at the 2 links again - I think the difference that I want is to have
the generc change to all franctions typed as say 8/9 converted into 8 over 9
with a horizontal in between. It seems to me that the links describe a
method that has to be done for each and every fraction that you type!
Correct? Is there a way to have auto correct / format all the / oblique
typed fractions into a horizontal line dividingthe numerator and
denominator?
Mike
 
G

Graham Mayor

It seems that the index of articles on the MVPS web site is due for an
update :(
If you don't have a font that includes the fraction characters you require
then an EQ field has to be created for each fraction.
The alternative is to use a macro:

Sub FmtFraction()
Dim OrigFrac As String
Dim Numerator As String, Denominator As String
Dim NewSlashChar As String
Dim SlashPos As Integer
NewSlashChar = "/"
Selection.MoveLeft Unit:=wdWord, Count:=3, Extend:=wdExtend
OrigFrac = Selection
SlashPos = InStr(OrigFrac, "/")
Numerator = Left(OrigFrac, SlashPos - 1)
Denominator = Right(OrigFrac, Len(OrigFrac) - SlashPos)
Selection.Font.Superscript = True
Selection.TypeText Text:=Numerator
Selection.Font.Superscript = False
Selection.TypeText Text:=NewSlashChar
Selection.Font.Subscript = True
Selection.TypeText Text:=Denominator
Selection.Font.Subscript = False
End Sub

Select the fraction and run the macro

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
T

Tanis

Have you tried the equation editor? I have a similar problem with trying
to insert the symbols for mean, an X with a bar and grand mean X with
double bar. Whilst tring to find an answer, I stumbled across the
equation editor.

David
 
M

MikeR-Oz

Ed,

I have downloaded the program - thanks - and installed it - it certainly
reads like what I am looking for - BUT icannot seeem to get it to work - I
have attached the tempalte to the document and then tried
tools\maro\macros\insertvertfraction2 but I get an Microsoft Visual Basic
error box wich sais "The Macros in this project are disbaled. Plse refer to
the online help or documentation of the host application to determine how to
enable macros"

BUT I do not know what to do to get this happening.

any help?

Thanks Mike
 
S

Suzanne S. Barnhill

Have you tried doing what the message box says? If you look in Word's Help
for "enable macros," you will find several helpful articles.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
M

MikeR-Oz

Thanks Suzanne - you are always there! I have tried to look this up - but I
cannot see/read anything that appears to be correct for the 'enable macros'
error.
Regards
Mike
 
S

Suzanne S. Barnhill

You'll have to ask the author of the macros. I don't speak VBA.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
M

MikeR-Oz

Ed, the 1st macro 'InsertVertFraction' works fine but when i try to run
'InsertVertFraction 2' I get the the word Error! where the numbers were
entered and highlighted when i applied the macro 'InsertVertFraction 2'.
When I toggle field codes over the error! I get {EQ \F(2,12)} which I
believe is correct - but why the error?

Your help please ED.
Mike
 
M

MikeR-Oz

Thanks David - I think Ed's VB program is what I need - I just have to work
out how to use it.
Mike
 
D

Doug Robbins - Word MVP

{ EQ \F (2,12 ) } is the correct field and it works fine here. Have you
tried updating the field using F9 to see if that clears the error?

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
M

MikeR-Oz

OK, I have worked out what I was doing wrong - wen I highighted the numbers
say 2/12, it was also highlighting an extra space after the 12 so, as soon
as I made the high lighting JUST the numbers it all worked fine! NOW I
cannot seem to edit the macro so I can change the font size and style like
ED mentions in the document -"Changes You Can Make
I have arbitrarily chosen a font size of 8 points for the fraction. If this
is not what you want, simply select the fraction and change the font as you
normally would with any text. You can also make a permanent change in the
programs by simply changing the “8” in the macro code to the point size you
want. Look for the line in both programs
..Font. Size=8
and change the 8 to any number you want. Make no other changes to the code
unless directed to do so. I will not give support to anyone who makes
unauthorized changes"-

BUT How?
Mike
 
D

Doug Robbins - Word MVP

You will have to open the Visual Basic Editor (Alt+F11) and look at the code
in the macros InsertVerticalFraction and InsertVerticalFraction2 and change
the

.Font.Size = 8

to what ever size you want in the following part of the code near the bottom
of each macro.

With fieldRange
..Select
.InsertAfter "EQ \F(" & strFraction & ")"
.Font.Size = 8
.SetRange Start:=.End + 1, End:=.End + 1
.InsertAfter " "
.Font.Reset
.Select
End With

Or, from the Tools menu, select Macro and then Macros and select the macro
and then click on the Edit button.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
M

MikeR-Oz

Doug - I have tried doing what you suggested prior to you post - BUT in the
tools\macros\macros\edit - NONE of the macros have the edit button able to
be selected as the button is dim.

I have tried the VB editor but i guess I do not know my way around that well
enough to be able to use it as I get the 'project is locked' message when I
click on the InsertVert.fraction macro.
??
Mike
 
E

Ed Weber

If you installed the dot file by copying it to the Word Startup folder, Word
locks the macros for editing. You must open the dot file then do the
editing. Click File>Open. Navigate to the Startup folder and double-click
on the dot file. This will open the dot file as though it is a document.
Click Tools>Macro>Macros. Click the name of the macro then click Edit.
This will open the VBE. Change both sizes to whatever you want. Return to
the Word editing screeen then save and close the dot file.
 
E

Ed Weber

I should have also mentioned in my other message that, if you did not copy
the dot file to the Startup folder, follow the same instructions but
navigate to whatever folder contains the dot file.

If you still have problems, remove NOSPAM from my email address and send me
an email telling me what size font you want. I will make the changes and
send you a modified copy of the dot file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top