Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tech Tips & Tricks
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > General Technology > Tech Tips & Tricks >
Fractions Macro for Word

Reply  
Thread Tools
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
07-Aug-2005, 03:19 PM #1
Fractions Macro for Word
If you want to display fractions properly in Word here is a macro which will do just that. Type in something like 3/4 then select it with the mouse then run the Macro and the fraction will be displayed correctly. Here it is: -


Sub FmtFraction()
Dim OrigFrac As String
Dim Numerator As String, Denominator As String
Dim NewSlashChar As String
Dim SlashPos As Integer
NewSlashChar = ChrW(&H2044)
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
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck
rameam's Avatar
Senior Member with 716 posts.
 
Join Date: Mar 2003
07-Aug-2005, 04:47 PM #2
Thanks Saxon,

I use Word a lot, and can use that!
HLHHMC's Avatar
Member with 59 posts.
 
Join Date: Aug 2005
Location: Ponte Vedra Beach, FL
Experience: Beginner
07-Aug-2005, 08:00 PM #3
thanks ill use that as well
Nita's Avatar
Member with 493 posts.
 
Join Date: Feb 2004
08-Aug-2005, 01:31 AM #4
Please explain how to use it.
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
08-Aug-2005, 06:35 AM #5
One way to get this Macro into Word is as follows

1.Select the Macro shown above with the mouse and copy it.
2. Click on Tools in the Menu bar in Word then on Macro>Record new macro
3. In the Window that appears, in the box labelled Macro name type FmtFraction (no spaces) click OK
4. A small Macro recorder box will appear on screen click on the square button to stop recording.
5. Click on Tools in the Menu bar again and choose Macro>Macros, you will see FmtFraction listed in the pane, click on it then click on the Step Into button.
6. You will now be in the Visual Basic editor, scroll down till you see the Sub FmtFraction () line, delete this line carefully and everything below it
7. Paste in the Macro you copied earlier, now click on File>Save Normal in the Menu bar then on File>Close and return to Microsoft Word

Now follow the brief instruction given in my previous post. To run a Macro click Macro>Macros click on the FmtFraction macro then on the Run button. You can also create a Toolbar button to run this Macro with one click. Details of this will be given if required.
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck
HLHHMC's Avatar
Member with 59 posts.
 
Join Date: Aug 2005
Location: Ponte Vedra Beach, FL
Experience: Beginner
08-Aug-2005, 05:56 PM #6
What if the fraction is of the form 127/5 (or any fraction that involes a numeratior larger than 9) ... it doesn't seem to work. When I run the macro with the above fraction it returns to me 1/5. It is in the correct format but obviously the wrong fraction.

Thanks for any help and good work on the above macro
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
09-Aug-2005, 06:40 AM #7
Tried the 127/5 and it worked perfectly in Word 2000.
HLHHMC's Avatar
Member with 59 posts.
 
Join Date: Aug 2005
Location: Ponte Vedra Beach, FL
Experience: Beginner
09-Aug-2005, 11:33 AM #8
maybe it just doesnt work in word 97, could be the case...no worries though

thanks
Nita's Avatar
Member with 493 posts.
 
Join Date: Feb 2004
12-Aug-2005, 11:14 AM #9
Thanks Saxon but there doesn't seem to be a macro option in my windws 98SE word 2000. The only time the word macro appears is when I click on customise and then commands but I can't seem to type anything in there. Any ideas
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
12-Aug-2005, 01:34 PM #10
Don't you have the word Macro in the list when you click on the Tools option on the Menu bar? If not, a quick fix is click on the Customize link again then click on the Commands tab, now in the Categories list on the left click on Tools. Scroll down the list on the right till you see two entries Macroand Record Macro/Stop Recorder. With your left mouse button click and drag each of these in turn to the Tools entry in the Menu bar. The Tools list will then open and you can place each anywhere in the list and release the mouse button. Now click on close in the Customize box. You will now have the Macro entries listed under Tools and you can now create and use Macros.

If you find you more missing entries like this there is a command to reset your Toolbars etc to the Factory defaults. Just Ask.
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck

Last edited by Saxon; 12-Aug-2005 at 02:31 PM..
Nita's Avatar
Member with 493 posts.
 
Join Date: Feb 2004
13-Aug-2005, 08:22 AM #11
Thanks Saxon. There is a "macros" in the command tab but no "Record Macro/Stop Recorder" I don't know how to reset the toolbars.
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
13-Aug-2005, 09:10 AM #12
OK, go into the Customize box again, click on the Options tab then click on the button labelled 'Reset my usage data'. A message will appear saying your Toolbars and Menus will be set to the Default, Click OK. You may need to close down Word then open it again to see the changes.
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck
Nita's Avatar
Member with 493 posts.
 
Join Date: Feb 2004
13-Aug-2005, 03:38 PM #13
Thanks for your patience. I did as you said but nothing changed even after shutting down and rebooting. I don't understand it as when I went on to help for recording macros I got the same advice as you gave me but I simply don't get the option to record macros. When I click on macros in the categories boxthe the adjacent panel shows 4 different template projects 3 of which are connected to my palm. Unfortunately I have forgotten how to do a print screen otherwise I could show you
Saxon's Avatar
Senior Member with 328 posts.
 
Join Date: Jul 2005
Experience: Advanced
13-Aug-2005, 06:21 PM #14
Click on the Start button, click on Run, then Copy and Paste the line after the dotted line below into your Run box. Click OK. The /a switch will load up Word so that Normal.dot is ignored, templates in the Startup folder are ignored. Any add-in libraries (.wll files) are ignored. and user settings in the Windows Registry are ignored.

If you can now see the Macros entry under tools in the Menu Bar there may something wrong with the Normal.dot file which Word uses as a default template, and all instances of this should be deleted from your computer. Tell me if you see the Macro Entry after using this fix below and we'll take it from there.

------------------------------------------------------------

"C:\Program Files\Microsoft Office\Office\WINWORD.EXE" /a
__________________
"We can proceed with a velvet glove, but within must lie an iron fist."

Otto Von Bismarck
Nita's Avatar
Member with 493 posts.
 
Join Date: Feb 2004
14-Aug-2005, 07:17 AM #15
The only thing that has changed is that when I click on macros in the command categories the right hand panel is now empty.There is still no macros when I justclick on tools.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:37 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.