Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2014, 05:40 PM
romanticbiro romanticbiro is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers Office 2003
Advanced Beginner
code to rewrite numbers
 
Join Date: Feb 2014
Posts: 42
romanticbiro is on a distinguished road
Question code to rewrite numbers

hello sirs
wish you help me by your knowledge
i've a long word documents need to change some numbers on it
as you know in ms-word when we wrote numbers in Arabic from right to left the program reverse it to look as o'clock left to right
example : if we want this one and half wrote it 30:1 to appear 1: 30
so, people here wrote wrong to appear right, now, i need to reverse those number cause screen-reader read them wrong it read for me what we wrote not what word show (as a blind man)


is any way let me rewrite all numbers again from 30:1 to 1:30 ?
am so sorry for this long message
many thanks
Reply With Quote
  #2  
Old 02-10-2014, 06:06 PM
gmaxey gmaxey is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Sub Macro1()
Dim oRng As Word.Range
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting
  Set oRng = ActiveDocument.Range
  With oRng.Find 'Selection.Find
    .Text = "([0-9]{1,})(:)([0-9]{1,})"
    .Replacement.Text = "\3\2\1"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 02-11-2014, 07:41 AM
romanticbiro romanticbiro is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers Office 2003
Advanced Beginner
code to rewrite numbers
 
Join Date: Feb 2014
Posts: 42
romanticbiro is on a distinguished road
Default

dear gmaxey
thanks very much for your help.
please
could you explain this code
i tried it via find and replace command
the question
if the number 10:50 need to be 50:10
this work or need to change thing?

another point, is any solution let word show numbers from right to left as we wrote? to not need to write wrong to show right
many thanks again
Reply With Quote
  #4  
Old 02-14-2014, 09:55 PM
macropod's Avatar
macropod macropod is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers 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

Quote:
Originally Posted by romanticbiro View Post
if the number 10:50 need to be 50:10
this work or need to change thing?

another point, is any solution let word show numbers from right to left as we wrote? to not need to write wrong to show right
many thanks again
Did you try the macro?

FWIW, the equivalent wildcard Find/Replace without using a macro is:
Code:
Find = ([0-9]{1,})(:)([0-9]{1,})
Replace = \3\2\1
However, both that and the macro are dependent on your PC's regional settings. A wildcard Find/Replace that should work independently of your regional settings is:
Code:
Find = (<[0-9]@)(:)([0-9]@>)
Replace = \3\2\1
You could also use the same expressions in the macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-15-2014, 07:20 AM
romanticbiro romanticbiro is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers Office 2003
Advanced Beginner
code to rewrite numbers
 
Join Date: Feb 2014
Posts: 42
romanticbiro is on a distinguished road
Default

pls. what's the different between 2 exprissions?
Reply With Quote
  #6  
Old 02-15-2014, 01:25 PM
macropod's Avatar
macropod macropod is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers 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

What is different is that one could be affected by your regional settings; the other isn't. For some regions (those that use ',' as a decimal separator), the {1,} would have to be changed to {1;}
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-15-2014, 02:55 PM
romanticbiro romanticbiro is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers Office 2003
Advanced Beginner
code to rewrite numbers
 
Join Date: Feb 2014
Posts: 42
romanticbiro is on a distinguished road
Default

is there anyway let word show numbers as we wrote and not need to wrote wrong to appear right on screen?
for example: if we want to write one and half, now we wrote 30:1 to be shown 1 : 30
and this make big problem with my screen-reader while read documents.
thanks
Reply With Quote
  #8  
Old 02-15-2014, 03:04 PM
macropod's Avatar
macropod macropod is offline code to rewrite numbers Windows 7 32bit code to rewrite numbers 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

If you want to add spaces either side of the colon, change \3\2\1 to \3 \2 \1.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the formatting of numbers without changing the numbers? sullengirl Word 2 01-27-2014 03:06 PM
How do I refer to page numbers, when the numbers change as I prepare the document? StevenD Word 5 11-29-2012 12:52 AM
code to rewrite numbers Where does my code go? rbaldwin Word VBA 3 03-14-2012 02:31 PM
code to rewrite numbers Page Numbers Not Matching Chapter Numbers gracie5290 Word 1 02-02-2012 11:41 PM
Extract Numbers from Zip Code Karen615 Excel 3 09-21-2011 06:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:19 PM.


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