Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Toggle form field between U.S. dollars and Euros
I have a finance form that my user would like to be able to show the entry as
either U.S. dollars or European Euros. Normally, the field would be set to dollars and the format to reflect $x,xx.00. The Euro is formatted differently. Can I use a check box or other device to affect the formatting of the field? Best regards... Lenny |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Toggle form field between U.S. dollars and Euros
Lenny wrote:
I have a finance form that my user would like to be able to show the entry as either U.S. dollars or European Euros. Normally, the field would be set to dollars and the format to reflect $x,xx.00. The Euro is formatted differently. Can I use a check box or other device to affect the formatting of the field? Best regards... Lenny One way you can do this is with a checkbox field and a macro run on exit from that checkbox. The checkbox must be after the numeric input field(s). The field that will represent the number must be formatted with a unicode font that has the Euro symbol. In the example macro, the numeric field is Text1 and the Checkbox field is Check1. The macro reads the numeric entry in Text1 (***which should be a regular text field***) and adds the Dollar or Euro sign. If there are calculations involved with the content of the form field(s), they will have to be performed in the macro and the result field(s) updated accordingly, as a text field with a leading text character will not work in a calculation. The basic code example is: Sub CashFormat() Dim sValue As String sValue = ActiveDocument.FormFields("Text1").Result If InStr(1, sValue, "$") Then sValue = replace(sValue, "$", "") End If If InStr(1, sValue, "?") Then sValue = replace(sValue, "?", "") End If If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then ActiveDocument.FormFields("Text1").Result = "$" & sValue Else ActiveDocument.FormFields("Text1").Result = "?" & sValue End If End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Make 1 Million Dollars $$ | New Users | |||
Make 1 Million Dollars $$$ | New Users | |||
Can i make the euros sign | Microsoft Word Help | |||
How do I set default on Toggle Field Codes? | Microsoft Word Help | |||
Toggle field codes. | New Users |