Text formfields are dynamically created, named and some are assigned a value. I need to set the format of some of the form fields to currency after they are created.
I have tried setting the formatting on the front end, in the formfield properties window, which works. But I need to do this when code generates teh form fields. I've attempted different variations on .TextInput and .Format Properties. There have not been any other issues with the formfields.
ActiveDocument.FormFields("name").TextInput.Format="$#,##0"
It should set the formfield to take any input and format it as currency. The properties of FormField that look relevant seem to be mostly read-only. Google hasn't yielded anything helpful.
The purpose of the form is to map several pieces of info, then let the user fill out the rest, or update mapped fields. I'm using formfields because it's a form, and its structure needs to be protected. The protection is set to "Filling in Forms", but that doesn't change the outcome for the format. In addition, formfields are being added/removed depending on how many rows are returned. The formfields are generated from scratch every time it's mapped, and they have no formatting.
Setting the number format requires using TextInput.EditType
, for example:
ActiveDocument.FormFields("name").TextInput.EditType Type:=wdNumberText, Format:="Fr. 0.00"
Note that I got this by simply recording a macro when changing the form field properties...