วิธีการแปลงตัวเลขอารบิกเป็นเลขไทย หรือ แปลงตัวเลขไทยเป็นอารบิก ในเอกสาร Microsoft Word โดยจะเปลี่ยนเป็นตัวเลขที่ต้องการทั้งหมดในเอกสาร ไม่ต้องมาเปลี่ยนเองทีละตัว มาดูวิธีการทำกันครับ
1. เปิดโปรแกรม microsoft word แล้วไปที่แท็บ มุมมอง -> มาโคร -> แสดงมาโคร

2. ตั้งชื่อ แมโคร แล้วกด สร้าง

3. จะปรากฏหน้าต่างสำหรับสร้าง แมโคร ดังภาพ

4. ให้ copy macro code ดังต่อไปนี้ ไปวาง
MACRO # 1
Sub arabictothai()
For i = 0 To 9
With Selection.Find
.Text = Chr(48 + i)
.Replacement.Text = Chr(240 + i)
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub
Sub thaitoarabic()
For i = 0 To 9
With Selection.Find
.Text = Chr(240 + i)
.Replacement.Text = Chr(48 + i)
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
End Sub
MACRO # 2
(กรณี MACRO # 1 ใช้ไม่ได้)
Sub arabic_to_thai()
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 thai_to_arabic()
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
5. ผลที่ได้จะออกมาดังภาพ จากนั้นให้กด save และกดปิดหน้าต่าง Microsoft Visual Basic ได้เลย

6. เท่านี้เป็นอันเสร็จสิ้นวิธีสร้างมาโครสำหรับเปลี่ยนสลับตัวเลข วิธีการใช้งานให้คลิกที่แท็บ มุมมอง -> มาโคร จะปรากฏคำสั่งให้เลือกใช้งาน ดังภาพ วิธีใช้งานคือเลือกที่คำสั่งที่ต้องการ แล้วกดปุ่มเรียกใช้

