Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Change Word page numbers into foreign language numerals.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amha - 09 Apr 2007 18:40 GMT
I have a document in Word created with Ethiopian language fonts. I would like
to change the page numbers into Ethiopian numerals. All the numbers in the
manuscript are between 1-2000. I can build a look uo table. Is there a way to
serach for page numbers and replace them with the character's in the look up
table??
Klaus Linke - 10 Apr 2007 01:24 GMT
Maybe you can adapt this. The macro assumes the page numbers are in the
built-in "Page Number" character style, and you replace them with your own
"EthiopianNumber" character style, which sets your Ethiopian font.
It uses a wildcard Find to match (arab) numbers, and assumes they're all
below 2000, or you'll get an error message when replacing.

Dim i As Long
Dim a(1, 2000)  ' your lookup table
For i = 0 To 2000
  a(0, i) = Trim(STR(i))
  ' store the ethiopian number in a(1,i), instead of the next line:
  a(1, i) = Trim(STR(2 * i))
Next i
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles(wdStylePageNumber)
Do
  With Selection.Find
     .Text = "[0-9]{1;}"
     .Replacement.Text = ""
     .Forward = True
     .Wrap = wdFindContinue
     .Format = True
     .MatchWildcards = True
  End With
  If Selection.Find.Execute Then
     Selection.Style = ActiveDocument.Styles("EthiopianNumber")
     Selection.Text = a(1, Val(Selection.Text))
  Else
     MsgBox "Done", vbInformation
     Exit Sub
  End If
Loop

Regards,
Klaus

>I have a document in Word created with Ethiopian language fonts. I would
>like
[quoted text clipped - 4 lines]
> up
> table??
Peter Jamieson - 10 Apr 2007 09:28 GMT
If Ethiopian numerals the ones where you have different characters for
1-10,20,30,...,90,100 and so on, I think you will have a problem here if
your page numbers are inserted using { PAGE } fields in a header or footer,
because
a. you can't simply change the font of the { PAGE } field result using a
\*Charformat switch
b. unless every page is in a separate Word section, you won't be able to
replace the { PAGE } result by a different number on each page, because the
same header/footer is used for the whole section.

What you can do is
a. create Word Document variables with names such as

e1
e2
e3

and the corresponding strings required for the numerals
b. instead of PAGE fields, use the following nested fields:

{ DOCVARIABLE "e{ PAGE }" \*Charformat }
c. if necessary, format the D of Docvariable with the font you need to use

All the {} need to be the special field code braces you can insert using
ctrl-F9.

Also, you probably have many references to those page numbers - how to deal
with those probably depends on how you are making the references.

Peter Jamieson
>I have a document in Word created with Ethiopian language fonts. I would
>like
[quoted text clipped - 4 lines]
> up
> table??
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.