![]() |
|
#1
|
|||
|
|||
|
Convert a number into Hindi without affecting the other numbers the same file
File attachment explains my question |
|
#2
|
||||
|
||||
|
You can use code like the following to convert a selected number to Hindi script.
Code:
Sub ArabicToHindi()
Application.ScreenUpdating = False
Dim fRng As Range, StrTmp As String, i As Long
Set fRng = Selection.Range
With Selection.Range
.Collapse wdCollapseStart
With .Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Text = "<[,.0-9]{1,}"
.Replacement.Text = ""
.Execute
End With
Do While .Find.Found
MsgBox fRng.Start & vbTab & fRng.End _
& vbCr & .Start & vbTab & .End
If .InRange(fRng) = False Then Exit Do
With .Duplicate
If .Characters.Last = "." Then .End = .End - 1
If .Characters.Last = "," Then .End = .End - 1
' If the numbers are input right-to-left, use:
StrTmp = Reverse(.Text)
' If the numbers are input left-to-right, use:
'StrTmp = .Text
For i = 0 To 9
StrTmp = Replace(StrTmp, Chr(48 + i), ChrW(1632 + i))
Next i
.Text = StrTmp
'apply Hindi proofing language
.LanguageID = wdHindi
End With
.Collapse (wdCollapseEnd)
.Find.Execute
Loop
End With
fRng.Select
Application.ScreenUpdating = False
End Sub
Function Reverse(StrTmp As String) As String
If (Len(StrTmp) > 1) Then
Reverse = Reverse(Mid$(StrTmp, 2)) + Left$(StrTmp, 1)
Else
Reverse = StrTmp
End If
End Function
Since your numbers are in the page header, you'll have to select them there before running the macro. I also note that your '71002' is a field code. The macro will convert that to plain text. For macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
I do not know how to use the code
|
|
#4
|
|||
|
|||
|
i try to use the code , but no change
|
|
#5
|
|||
|
|||
|
After Use Code
Is of the nature of the user field It is the reverse of the file numbering |
|
#6
|
||||
|
||||
|
Please pay attention to what you've already been told in post #2
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#7
|
|||
|
|||
|
thank you very much
and i'm Sorry for the misunderstanding because i'm not good in English but i do my file |
|
#8
|
||||
|
||||
|
Did you select what you want to change, then run the macro? I cannot see any indication of what you have done.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#9
|
|||
|
|||
|
look to my attached file in last post 111.docx
the number 7005 in Hindi |
|
#10
|
|||
|
|||
|
look also to these files
|
|
#11
|
||||
|
||||
|
Quote:
Please don't keep attaching files that don't show that you've done as the instructions say, especially when you haven't even answered the questions I have asked.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#12
|
|||
|
|||
|
i do what u told me
i select what i want to change, then run the macro |
|
#13
|
||||
|
||||
|
Well, that looks to me like the code is working - 1 / 7 / 71002 gets changed to ١ / ٧ / ٧١٠٠٢. So what do you mean when you say it's not working?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#14
|
|||
|
|||
|
I mean when i say it's not working
that is the first time to use code and i dont know how to use it but i search on net and i do it thank you too much |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Cannot Convert Text Cell to number format to be able to sort the data
|
jyfuller | Excel | 10 | 06-19-2013 05:31 PM |
convert to number
|
gsrikanth | Excel | 1 | 01-09-2012 01:01 AM |
| Convert .ost to .pst | phoy | Outlook | 1 | 12-03-2011 07:07 PM |
Mailing: how to make the "page number" in Word is the same as "row number" in excel w
|
Jamal NUMAN | Word | 1 | 09-03-2011 11:37 AM |
| Convert Number to Text | devcon | Word | 0 | 07-10-2010 01:16 AM |