Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2018, 03:56 PM
1cowabunga 1cowabunga is offline remove stacking fractions Windows 7 64bit remove stacking fractions Office 2010 64bit
Novice
remove stacking fractions
 
Join Date: Oct 2018
Posts: 2
1cowabunga is on a distinguished road
Default remove stacking fractions

I have about a hundred documents that I am needing to replace stacked fractions (auto-formatted) with regular unstacked text like this " 1/4 " Is there a quick way of doing this to save me an hour of work? Thanks!
Reply With Quote
  #2  
Old 10-18-2018, 10:01 PM
macropod's Avatar
macropod macropod is offline remove stacking fractions Windows 7 64bit remove stacking fractions Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

The ¼, ½, & ¾ fractions are typically single characters, not the three separate characters you'd get with fractions like 1/3, 2/3, etc. Assuming what you have is the ¼, ½, & ¾ characters, you can simply use Find/Replace to replace ¼ with 1/4, ½ with 1/2, & ¾ with 3/4. For a macro you might use to process a folder full of document containing such fractions, try:
Code:
Sub BulkFindReplace()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document, i As Long
Dim FList, RList: FList = Array("¼", "½", "¾"): RList = Array("1/4", "1/2", "3/4")
'Get the folder to process
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
'Process each document in the folder
While strFile <> ""
  If strFolder & "\" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
    'Process each word from the F/R List
    With wdDoc
      With .Range.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .MatchWholeWord = True
        .MatchCase = True
        .Wrap = wdFindContinue
        'Process each item in the Find/Replace Lists
        'First dealing with numbers like 1?
        For i = 0 To UBound(FList)
          .Text = "([0-9])" & FList(i)
          .Replacement.Text = "\1^s" & RList(i)
          .Execute Replace:=wdReplaceAll
        Next
        'Then processing and remaining fraction charcters
        For i = 0 To UBound(FList)
          .Text = FList(i)
          .Replacement.Text = RList(i)
          .Execute Replace:=wdReplaceAll
        Next
      End With
      'Close the document
      .Close SaveChanges:=True
    End With
  End If
  'Get the next document
  strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
 
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
Do be aware that only single-character fractions and numbers combined with the single-character fractions, such as 1½, will be processed. A number like 1½, will now appear as 1 1/2.

For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: https://wordmvp.com/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-18-2018, 10:40 PM
1cowabunga 1cowabunga is offline remove stacking fractions Windows 7 64bit remove stacking fractions Office 2010 64bit
Novice
remove stacking fractions
 
Join Date: Oct 2018
Posts: 2
1cowabunga is on a distinguished road
Default

Macropod, thank you so much. This is extremely helpful! The single character find/replace will probably be sufficient but you've got me curious about macros. Is this a macro that I build inside Word itself? I am new to the macro world and will have to do more research. I am using Word 2010. Anything that can speed up my efficiency is worth looking into. Thanks again.


EDIT: Just noticed the links you gave at the bottom. I'll make sure to give it a read. thanks
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
remove stacking fractions Fractions Within Fractions ALAN_VA Word 1 12-13-2016 10:00 AM
PowerPoint 2013 and Image Stacking hamoneaster PowerPoint 2 09-06-2015 11:00 AM
Stacking charts and sending to front Waterdude Excel 0 08-13-2015 03:27 PM
autocorrect for fractions AusSoft Word 3 01-24-2010 06:55 PM
remove stacking fractions Inserting Fractions ali_c_uk Excel 1 11-29-2009 06:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:10 AM.


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