![]() |
#1
|
|||
|
|||
![]()
I'm in need of some expert help, i'm trying to switch a dollar amount into words, with dollars and cents. Below is what i have and it's returning to blank, not sure what i'm missing on this, but any suggestions would be greatly appreciated!
(Quote{Set Val {MERGEFIELD PCORevTotalCons}"=INT(Val)\* CardText} dollar{ =Int(Val)-1 \# "s;s;"}{ IF{=MOD(Val,1) \#0.00}>0 " and { ={ =MOD(Val,1)*100 \ # 0 } \* CardText } cent{ = INT(MOD(Val,1)*100-1) \# "s;s;" }" " and zero cents"}" \* First Cap} |
#2
|
||||
|
||||
![]()
Your field coding has various errors. Try:
{QUOTE{SET Val «PCORevTotalCons»}{=INT(Val) \* CardText}" dollar{=INT(Val)-1 \# "s;s;"}" {IF{=MOD(Val,1) \# 0.00}> 0 " and {=MOD(Val,1)*100 \# 0 \* CardText} cent{=INT(MOD(Val,1)*100-1) \# "s;s;"}"} \* FirstCap} You'll find essentially the same field coding in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this page (https://www.msofficeforums.com/mail-...ps-tricks.html), under the heading Mailmerge Number & Currency Formatting Note: The field brace pairs (i.e. '{ }') for the field code example above are all created in the mailmerge main document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from here. Nor is it practicable (for the most part) to add them via the standard Word dialogues. The spaces shown in the field constructions are all required. The line break, though, isn't needed - it just there for layout purposes
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thanks for your response macropod, I'm still not getting anything to return when i tried your code, I'm sure I'm missing something in the entry of the code.
I did the Alt F9 then copied and pasted your solution inside the {} of my current code, is there a better way to accomplish this? |
#4
|
||||
|
||||
![]()
You could use the macro found under Convert Text Representations of Fields to Working Fields in the Mailmerge Tips & Tricks 'Sticky' thread to convert the field representation I posted into a working field.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Great! That did the trick greatly appreciate your help!
One last question, if the value is negative, I'm getting an error, is there a way to update the code to switch a negative to a positive? |
#6
|
||||
|
||||
![]()
Simply change:
{SET Val «PCORevTotalCons»} to: {SET Val {=ABS(«PCORevTotalCons»)}}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Tags |
mail merge, mail merge code, mail merge help |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Formd | Mail Merge | 2 | 07-06-2022 01:21 PM |
![]() |
Karen615 | Excel | 8 | 04-09-2020 03:55 PM |
![]() |
Marcia | Mail Merge | 2 | 08-08-2019 06:08 AM |
help creating a dollar counter add-in | dstallworth | PowerPoint | 0 | 04-23-2017 12:49 PM |
Convert Dollar amount to text | GeorgeLawshe | Word | 0 | 03-07-2010 10:17 PM |