Prev: Ungrouping a Picture
Next: Looping UserForm ComboBox
From: Michelle H. Michelle on 6 Jun 2010 02:21 I am trying to create a very simple form in Word 2010 (RTM, on Win7) which has three fields: Qty, Unit Price, Ext. Price. Am using the legacy Text Form field for each. The details on how I set up properties is below. I restrict editing and then save it (as a DOTX, DOCX or even DOC-tried all), and then open it to type values in my fields. Here's the problem: the fields do not format the data as instructed. For example, I type in a unit price of $1.50 and it saves the value of "1". That's it, just the number 1, and does not format it as instructed (as currency). It displays the qty correctly, but it strips out the currency formatting for Ext. Price as well. All calculations are working (based on the values it saves in the form field, not the values I've typed in), but the formatting is in error, and that makes the calculation results wrong. When I go back and view properties for each field, the number format is blank - as if I never selected/changed it. If I select again, restrict, save, and try again, still no formatting. What might be causing this? I've tried in an old document and a brand new one and the same thing happens. Information from this point forward is supplemental about how I set properties for each field. After I insert each field, I open the Properties and make appropriate changes: Qty field: Number type, unlimited length, number format #,##0, calculate on exit checked. Unit Price field: Number type, unlimited length, number format $#,##0.00;($#,##0.00), calculate on exit checked. Ext price field: Calculation, unlimited length, number format $#,##0.00;($#,##0.00), calculate on exit NOT checked. Editing restrictions are set to allow only Filling in forms. Thanks for any insights you might have.
From: Doug Robbins - Word MVP on 6 Jun 2010 03:22 That is an issue that I came across last week. A way around the problem is to run the following macro on exit from any formfield to which you want to apply the formatting: Sub formatfldresult() Dim ffname As String ffname = Selection.Bookmarks(Selection.Bookmarks.Count).Name With ActiveDocument.FormFields(ffname) .Result = Format(.Result, "$#,###.00") End With End Sub -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Michelle H." <Michelle H.(a)discussions.microsoft.com> wrote in message news:56CC6CD0-1992-446C-9660-1BF57AA1725D(a)microsoft.com... > I am trying to create a very simple form in Word 2010 (RTM, on Win7) which > has three fields: Qty, Unit Price, Ext. Price. Am using the legacy Text > Form > field for each. The details on how I set up properties is below. > I restrict editing and then save it (as a DOTX, DOCX or even DOC-tried > all), > and then open it to type values in my fields. Here's the problem: the > fields > do not format the data as instructed. For example, I type in a unit price > of > $1.50 and it saves the value of "1". That's it, just the number 1, and > does > not format it as instructed (as currency). It displays the qty correctly, > but it strips out the currency formatting for Ext. Price as well. All > calculations are working (based on the values it saves in the form field, > not > the values I've typed in), but the formatting is in error, and that makes > the > calculation results wrong. > > When I go back and view properties for each field, the number format is > blank - as if I never selected/changed it. If I select again, restrict, > save, and try again, still no formatting. > What might be causing this? I've tried in an old document and a brand new > one and the same thing happens. Information from this point forward is > supplemental about how I set properties for each field. > > After I insert each field, I open the Properties and make appropriate > changes: > Qty field: Number type, unlimited length, number format #,##0, calculate > on > exit checked. > Unit Price field: Number type, unlimited length, number format > $#,##0.00;($#,##0.00), calculate on exit checked. > Ext price field: Calculation, unlimited length, number format > $#,##0.00;($#,##0.00), calculate on exit NOT checked. > Editing restrictions are set to allow only Filling in forms. > > Thanks for any insights you might have. > >
|
Pages: 1 Prev: Ungrouping a Picture Next: Looping UserForm ComboBox |