0
달러 통화 형식을 사용했습니다. 그것은 잘 작동합니다. 유로, 파운드와 같은 다른 통화에 대해 수행하려는 동일한 통화 서식. 다음은 내가 시도한 코드입니다. Pls 도움.통화 VBA를 사용하여 유로화로 된 단어 서식
코드 :
는Sub CurrencyFormat_UK()
'
' Currency formating
'
Dim oCl As Word.Cell
Dim oRng As Range
'
' Condition to check the selected data
'
If Selection.Type = wdSelectionIP Or _
Not Selection.Information(wdWithInTable) Then
MsgBox "Select a cell or range of cells before running" _
& " this macro.", , "Nothing Selected"
Exit Sub
End If
For Each oCl In Selection.Cells
Set oRng = oCl.Range
'
'Drop of the end of cell mark
'
oRng.End = oRng.End - 1
With oRng
If IsNumeric(oRng) Then
.Text = FormatCurrency(Expression:=.Text, NumDigitsAfterDecimal:=2, _
IncludeLeadingDigit:=vbTrue, UseParensForNegativeNumbers:=vbTrue)
End If
If oRng.Characters.count = 1 Then GoTo Skip
On Error GoTo Skip
'Catch errors here
If InStr(oRng.Text, "€") = False Then
oRng.Font.Color = wdColorRed
oRng.Select
MsgBox "Cell content is not numerical.", , "Error"
Selection.Collapse wdCollapseEnd
End If
Skip:
End With
Next oCl
lbl_Exit:
Exit Sub
End Sub
어떤 오류가 있습니까? 우리는 어떻게하면 작동하지 않는지 말하지 않으면 어떻게 도울 수 있습니까? – CyberClaw
사실 "FormatCurrency"함수는 달러의 코드 형식에서 자동으로 사용됩니다. 다른 통화로도 형식을 지정할 수있는 다른 방법이 있습니까? –
누군가가 당신을 위해 일하기를 원하면 프로그래머에게 돈을 지불해야합니다. 이 웹 사이트는 "의심의 여지가 있거나 실수를 저질렀을 때 도움을 요청하는 프로그래머를위한 것입니다."제발 나를 위해 모든 일을 해주십시오, ktkxbai! " – CyberClaw