숫자 철자가 필요할 때가 있습니다. 예를 들어, “1234”를 “1 천이 백삼 십사”로 표기 할 수 있습니다.

Word에는 변환을 수행하는 기본 제공 기능이 없으므로 변환을 처리 할 매크로를 만들어야합니다.

다음 매크로 BigCardText는 0에서 999,999,999 사이의 숫자를 변환합니다. 이를 사용하려면 변환하려는 숫자 내 또는 숫자 오른쪽 (한 자리 인 경우)에 삽입 포인터를 놓기 만하면됩니다.

Sub BigCardText()

Dim sDigits As String     Dim sBigStuff As String

sBigStuff = ""



' Select the full number in which the insertion point is located     Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdMove     Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend

' Store the digits in a variable     sDigits = Trim(Selection.Text)



If Val(sDigits) > 999999 Then         If Val(sDigits) <= 999999999 Then             sBigStuff = Trim(Int(Str(Val(sDigits) / 1000000)))

' Create a field containing the big digits and             ' the cardtext format flag             Selection.Fields.Add Range:=Selection.Range, _               Type:=wdFieldEmpty, Text:="= " + sBigStuff + " \* CardText", _               PreserveFormatting:=True

' Select the field and copy it             Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend             sBigStuff = Selection.Text & " million "

sDigits = Right(sDigits, 6)

End If     End If     If Val(sDigits) <= 999999 Then         ' Create a field containing the digits and the cardtext format flag         Selection.Fields.Add Range:=Selection.Range, _           Type:=wdFieldEmpty, Text:="= " + sDigits + " \* CardText", _           PreserveFormatting:=True

' Select the field and copy it         Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend         sDigits = sBigStuff & Selection.Text

' Now put the words in the document         Selection.TypeText Text:=sDigits         Selection.TypeText Text:=" "

Else         MsgBox "Number too large", vbOKOnly     End If End Sub

매크로를 사용할 때 변환중인 숫자에 달러 기호 나 쉼표와 같은 관련없는 정보가 포함되어 있지 않은지 확인하십시오. BigCardText를 실행할 때 매크로는 선택한 숫자가 100 만 이상인지 확인합니다. 그럴 경우 먼저 백만이 넘는 부분에서 작동하여 단어로 변환합니다. 그런 다음 백만 미만의 값이 변환됩니다. 최종 전체 문구가 모아서 문서에 다시 붙여 넣어 사용할 수 있습니다.

_ 참고 : _

이 페이지 (또는 WordTips 사이트의 다른 페이지)에 설명 된 매크로를 사용하는 방법을 알고 싶다면 유용한 정보가 포함 된 특별 페이지를 준비했습니다.

link : / wordribbon-WordTipsMacros [새 브라우저 탭에서 특별 페이지를 열려면 여기를 클릭하세요].

_WordTips_는 비용 효율적인 Microsoft Word 교육을위한 소스입니다.

(Microsoft Word는 세계에서 가장 널리 사용되는 워드 프로세싱 소프트웨어입니다.)이 팁 (203)은 Microsoft Word 97, 2000, 2002 및 2003에 적용됩니다. Word의 리본 인터페이스에 대한이 팁 버전 (Word 2007)을 찾을 수 있습니다. 이후) 여기 :

link : / wordribbon-Converting_Numbers_to_Text [숫자를 텍스트로 변환].