VBA Word format mergefield

392 Views Asked by At

I have a fieldfunction that formats a given number (price) from an excel table.

i.e.:

Fieldname = FieldName & " \# #.##0,00 USD"

It works, but if the value is less than a thousand, the hashes and the point are read as spaces.

How can I remove or prevent the spaces to show up in the word file?

1

There are 1 best solutions below

0
On

Too many # in format..try this:

 Fieldname = FieldName & " \# #.#0,00 USD"

Just for further clarification, I didn't really know how the code above used in mergefield by questioner..usually formatting mergefield look like this:

 {MERGEFIELD  ANum \# "#.#0,00 USD"}