DavG63
09-08-2017, 03:51 AM
Hi
I've asked a variation on this question in the past and everyone was really great in helping me to figure out how to convert a numerical string added into a Userform into words.
For the purposes of the below example the number is entered into ComboBox1.
If Me.ComboBox1.Value <> vbNullString Then
Dim iSumOne As String
iSumOne = Me.ComboBox1.Value
oVars("SumOnePounds") = Split(iSumOne, Chr(46))(0)
If InStr(1, iSumOne, Chr(46)) > 0 Then
oVars("SumOnePence") = Split(iSumOne, Chr(46))(1)
Else
oVars("SumOnePence") = vbNullString
End If
If Me.ComboBox1.Value = vbNullString Then
iSumOne = vbNullString
oVars("SumOnePounds") = vbNullString
oVars("SumOnePence") = vbNullString
End If
End If
This works as it should for me when the resultant variables appear in my document:-
{IF {DocVariable SumOnePounds }="Error!*" "" {IF {DocVariable SumOnePounds } > 0 "{DocVariable SumOnePounds \*Cardtext \*Upper } POUNDS" }} {IF {DocVariable SumOnePence}="Error!*" "" {IF DocVariable SumOnePence} > 0 "And {DocVariable SumOnePence \*Cardtext \*Upper} {If {DocVariable SumOnePence } = 1 "PENNY" "PENCE" }}}
However a number of people who have used the final document have noted that the text result doesn't read quite how they need it if the number entered is over £100,000.
For example, if the sum entered is £125,000 it converts to:-
ONE HUNDRED TWENTY FIVE THOUSAND POUNDS
Whereas they would like it to read:-
ONE HUNDRED AND TWENTY FIVE THOUSAND POUNDS
It's a tiny grammatical change but it's one that I've struggled to implement.
If anyone has any suggestions on how to make that work I would be extremely grateful.
Thanks very much
Dav
I've asked a variation on this question in the past and everyone was really great in helping me to figure out how to convert a numerical string added into a Userform into words.
For the purposes of the below example the number is entered into ComboBox1.
If Me.ComboBox1.Value <> vbNullString Then
Dim iSumOne As String
iSumOne = Me.ComboBox1.Value
oVars("SumOnePounds") = Split(iSumOne, Chr(46))(0)
If InStr(1, iSumOne, Chr(46)) > 0 Then
oVars("SumOnePence") = Split(iSumOne, Chr(46))(1)
Else
oVars("SumOnePence") = vbNullString
End If
If Me.ComboBox1.Value = vbNullString Then
iSumOne = vbNullString
oVars("SumOnePounds") = vbNullString
oVars("SumOnePence") = vbNullString
End If
End If
This works as it should for me when the resultant variables appear in my document:-
{IF {DocVariable SumOnePounds }="Error!*" "" {IF {DocVariable SumOnePounds } > 0 "{DocVariable SumOnePounds \*Cardtext \*Upper } POUNDS" }} {IF {DocVariable SumOnePence}="Error!*" "" {IF DocVariable SumOnePence} > 0 "And {DocVariable SumOnePence \*Cardtext \*Upper} {If {DocVariable SumOnePence } = 1 "PENNY" "PENCE" }}}
However a number of people who have used the final document have noted that the text result doesn't read quite how they need it if the number entered is over £100,000.
For example, if the sum entered is £125,000 it converts to:-
ONE HUNDRED TWENTY FIVE THOUSAND POUNDS
Whereas they would like it to read:-
ONE HUNDRED AND TWENTY FIVE THOUSAND POUNDS
It's a tiny grammatical change but it's one that I've struggled to implement.
If anyone has any suggestions on how to make that work I would be extremely grateful.
Thanks very much
Dav