Escolar Documentos
Profissional Documentos
Cultura Documentos
'exceleaccess.com
Dim strMoeda As String
Dim cents As Variant
Dim decimalSep As String
If valor > 999999999999999# Then
Extenso_Valor = "Valor excede 999.999.999.999.999"
Exit Function
End If
If WorksheetFunction.RoundDown(valor, 0) = 1 Then
strMoeda = " real"
ElseIf WorksheetFunction.RoundDown(valor, 0) > 1 Then
strMoeda = " reais"
End If
cents = valor - WorksheetFunction.RoundDown(valor, 0)
valor = valor - CDbl(cents)
cents = centavos(CDbl(cents) * 100)
If cents <> "" And valor >= 1 Then
cents = " e " & cents
End If
strMoeda = Trim(Trilhoes(valor)) & strMoeda & cents
strMoeda = Replace(strMoeda, ", e", " e")
strMoeda = Replace(strMoeda, ", r", " r")
If Left(strMoeda, 2) = "e " Then
strMoeda = Mid(strMoeda, 3, Len(strMoeda))
End If
vzz = "00000000000000000000"
vtam = Len(Trim(Mid(Trim(valor), 2, 100)))
If Right(vzz + vzz + vzz + vzz, vtam) = Mid(Trim(valor), 2, 100) And
InStr(UCase(strMoeda), UCase("es ")) > 0 Then
vetor = Split(strMoeda, " ")
vtrocar = vetor(UBound(vetor))
strMoeda = Replace(strMoeda, vtrocar, "de " + vtrocar)
End If
EA_Valor_Escrito = strMoeda
End Function
End Function
Function arredBaixo(valor)
'exceleaccess.com
Dim tmpValor
tmpValor = Round(CDbl(Right(Round(valor, 2) * 100, 2)) / 100, 2)
arredBaixo = Round(Round(valor, 2) - tmpValor, 0)
End Function