Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 12-31-2013, 09:20 PM
macropod's Avatar
macropod macropod is offline How to use this function in microsoft word? Windows 7 32bit How to use this function in microsoft word? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by kahheng93 View Post
i tried the link,first method do not allow me to edit the words such as 'dollars'
Microsoft’s ‘DollarText’ field switch doesn’t allow you to specify anything other than dollars. It also doesn't express a value as ‘X dollars and Y cents’ – it returns ‘X and Y/00’. Here’s a field code that takes a more sophisticated approach that allows you to change the currency and use much greater values:
Code:
{QUOTE {ASK Val "What is he amount?"}
{SET AbsVal {=ABS(Val)}}
{IF{=Val}< 0 "Minus "}
{IF{=INT(AbsVal/100000000)}<> 0 "{=INT(AbsVal/100000000) \*Cardtext} hundred "}
{IF{=MOD(INT(AbsVal/1000000),100)} <> 0 "{IF{=INT(AbsVal/100000000)}<> 0 "and "}"}
{IF{=INT(AbsVal/1000000)}<> 0 "{=MOD(INT(AbsVal/1000000),100) \*Cardtext} million, "}
{IF{=INT(AbsVal/100000)}<> 0 "{=MOD(INT(AbsVal/100000),10) \*Cardtext} hundred "}
{IF{=MOD(INT(AbsVal1000),100)} <> 0 "{IF{=INT(AbsVal/100000)}<> 0 "and "}"}
{IF{=INT(AbsVal/1000)}<> 0 "{=MOD(INT(AbsVal/1000),100) \*Cardtext} thousand, "}
{IF{=MOD(INT(AbsVal/100),10)}<> 0 "{=MOD(INT(AbsVal/100),10) \*Cardtext} hundred "}
{IF{=MOD(INT(AbsVal),100)}<> 0 "{IF{=INT(AbsVal/100)}<> 0 "and "}{=MOD(INT(AbsVal),100) \*Cardtext} "}
{=INT(AbsVal) \# \dollar;;}{IF{=INT(AbsVal)}> 1 "s"}
{IF{=MOD(AbsVal,1)}<> 0 "{IF{=INT(AbsVal)}<> 0 " and "}{=MOD(AbsVal,1)*100 \*Cardtext} cent{IF{=MOD(AbsVal,1)}> 0.01 s}"} \* FirstCap}
With this field you can go all the way to 999,999,999.99 (technically you could go two orders of magnitude higher). You can omit/edit the:{=INT(Val) \# \dollar;;}{IF{=INT(Val)}> 1 "s"} and {IF{=MOD(Val,1)}> 0.01 cents cent}"}portions if you want no/different currency. You could likewise omit the various tests for inserting 'and ', if you prefer.

Note: The field brace pairs (ie '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message.

You could also use a macro to convert the above to a working field. For that, see: http://www.gmayor.com/export_field.htm#TextToField
Quote:
second method has compile error syntax error when trying to run
That solution is designed for working with formfields only. Does your document contain the required formfields - with the required names?
Quote:
third method has errors when running the add-ins suchs as : "Could not load an object because it is not available on this machine" or "Compile error in hidden module" or macro cannot be found or has been disabled because of your macro security settings"
Did you install the correct version, as per the instructions given on that site?
Quote:
I tried enabled all macros in trust center and trust access to vba project object model... nothing works so far...
None of that should be necessary; indeed it opens your PC to macro virus attacks.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a graph for Future Value function (FV function) bmoody Excel 2 11-06-2013 10:52 AM
[HELP]Word: sub or function not defined royankidding Word VBA 0 08-29-2013 12:11 AM
OnClick function in Word Lakshit Word 0 09-27-2011 12:11 AM
Is there a function on MS Word showing the lastest changes made on a word file? _____ Word 2 10-30-2010 05:33 AM
Inserting citations using the reference function in Microsoft Word 2007? aeyara Word 0 09-28-2009 05:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft