การเปลี่ยนตัวเลขนี้ ใช้ได้ทั้งกับ ไฟล์ Word และ Excel โดยการตั้งค่าเพียงครั้งแรกครั้งเดียวเท่านั้น
เพื่อให้เห็นภาพและทำตามได้ง่ายขึ้น ผู้หมวด ได้สรุป วิธีทำ ออกมาเป็นแผนผัง ตามนี้นะคะ
โค้ดที่ต้องใช้ (ให้คัดลอกไปทั้งหมดนะคะ ตามตัวหนังสือสีน้ำเงินด้านล่างนี้)
Sub arabic_to_thai()
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 thai_to_arabic()
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อันนี้เป็นโค้ดสำรอง(ตัวหนังสือสีเขียว)
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
ความคิดเห็น
แสดงความคิดเห็น