มาโครแปลงเลข ไทย อาราบิกใน Microsoft Word

เข้าไปที่เมนู มุมมอง > แมโคร > แสดงแมโคร > พิมพ์ 1 แล้วกดสร้าง แล้ววางคำสั่งต่อไปนี้ลงไป

Sub Arabic2thai()
For i = 0 To 9
With Selection.Find
.Text = Chr(48 + i)
.Replacement.Text = ChrW(3664 + i)
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub


Sub Thai2Arabic()
For i = 0 To 9
With Selection.Find
.Text = ChrW(3664 + i)
.Replacement.Text = Chr(48 + i)
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub

Loading