My name isXXXXX and I am a certified Microsoft Word Expert affiliated with JustAnswers. Thank you for giving me the opportunity to assist you with your Word question.
Based on the way numerical fields and calculation fields work one option (if you want to remain with formfields) is to use formatted numerical fields for your variables using the following numerical format and leave the defualt numbe field blank:
and use a plain text field (with fill in enabled unchecked) for the result. You would need to assign the following macro to run on exit from your variable field.
Dim lngA As Long, lngB As Long, lngResult As Long
On Error Resume Next
lngA = CLng(ActiveDocument.FormFields("Text1").Result)
If Err.Number <> 0 Then lngA = 0
lngB = CLng(ActiveDocument.FormFields("Text2").Result)
If Err.Number <> 0 Then lngB = 0
On Error GoTo 0
lngResult = lngA + lngB
ActiveDocument.FormFields("Text3").Result = FormatCurrency(lngResult)
If ActiveDocument.FormFields("Text1").Result = "" Then
ActiveDocument.FormFields("Text2").Result = ""
ActiveDocument.FormFields("Text3").Result = ""
As an alternative you could leave the form as it is and offer you users to the option to clear all fields including the zeros before printing using this procedure:Sub ClearZeroes()Dim oFF As FormFieldFor Each oFF In ActiveDocument.FormFields oFF.Result = ""NextEnd Sub
For help installing and using this macro see: http://www.gmayor.com/installing_macro.htm