#1
|
|||
|
|||
How to use this function in microsoft word?
I am trying to implement the formula from here into microsoft word. It is working in excel but I always get Syntax Error (xxx) in microsoft word though. I tried looking everywhere on the web but still cant figure out how to do this in microsoft word,anyone can lend a hand? Really appreciate it! |
#2
|
|||
|
|||
Works perfectly for me.
Code:
Sub TryIt() Selection.TypeText ConvertCurrencyToEnglish("234.56") End Sub Two Hundred Thirty Four Dollars And Fifty Six Cents I did have to carefully clean up the copy and paste from that web page. It added a whole bunch of spaces. But the code works in Word. There is no syntax error in the code itself. If you are getting one there is something wrong with the text you are using. |
#3
|
|||
|
|||
Can i know what is that code you posted for? And i thought spaces doesnt matter in code? Sorry still new at this x.x
|
#4
|
|||
|
|||
I tried added that code of yours to the end of the code from that page, then i tried to run macro,and it works!! but how do I make it convert any numbers i want without keep changing the numbers in module?Thanks!
|
#5
|
|||
|
|||
I put this code in the module :
Then i go to word,create a table, and insert this: But all i get is this: Can i know how to make it work? I tried to use your code and yes it works but everytime i want to convert a different number I have to edit the code. Is there anyway simpler? This is intended for my mother for her work, and I doubt she can remember all the steps to go into the code and edit it everytime. |
#6
|
||||
|
||||
kahheng93: Please don't post multiple screenshots. If you want to post:
• code, post that (using the code tags on the advanced page) • error messages, post those as text. For a Word-based macro to convert numbers to text, see: http://gregmaxey.com/word_tip_pages/..._currency.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
noted, wont happen again. i tried the link,first method do not allow me to edit the words such as 'dollars' ; second method has compile error syntax error when trying to run ; 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". I tried enabled all macros in trust center and trust access to vba project object model... nothing works so far... x.x
|
#8
|
||||
|
||||
Quote:
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} 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:
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
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 |