Number formatting issue using VBA not working correctly
I am using the following VBA code whilst capturing a number in a WORD doc text form field, because the WORD document form that I am creating loses the formatting when you save and reload the document.
Despite having the correct format #,##0.00 the number truncates the decimals so that 45.67 appears as 45.00 – I suspect that this is happening at the input stage – any ideas ?
Sub formatfldresultN()
Dim ffname As String
ffname = Selection.Bookmarks(Selection.Bookmarks.Count).Name
With ActiveDocument.FormFields(ffname)
.Result = Format(.Result, "#,##0.00")
End With
End Sub
Attachment | Size |
---|---|
format-number-problem-nick.doc | 35 KB |
hi Paulan example file wld
hi Paul
an example file wld be very useful...
- edit ur post, and go to "file attachments"
I've attached a working example to your post