The information in this article applies to:
SYMPTOMSWhen you perform a calculation in a drop-down form field using the SetFormResult statement in a macro, the results are incorrect. CAUSENumbers entered in the list are not treated as numeric values; instead, they are considered text strings. Because the macro is performing a calculation on text not numbers, the results are incorrect. WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/supportnet/refguide/To work around this problem, you can modify your macro to include the GetFormResult statement in addition to the SetFormResult statement. This allows the macro to obtain the current values of the drop-down form field. You must then convert the text strings into numeric values before you can perform your calculations. Finally, the macro converts the number back to a string so that the value is displayed correctly in the destination. The following is a simple macro that demonstrates the use of both GetFormResult and SetFormResult.
Note: To insure that leading or trailing characters do not display,
in the formfield result, do the following in the TextForm Field Options
dialog box:
1.Select Number under Type.
2.Select Zero(0) under Number Format.
REFERENCES
"Microsoft Word Developer's Kit," version 6.0, pages 494-495 and 681
Additional query words: setformresult getformresult macro calculate calcuation add sum formfield form field dropdown drop down strange
Keywords : kbmacro wordnt winword ntword macword word6 word7 word95 |
Last Reviewed: December 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |