简体   繁体   English

VBA Word格式mergefield

[英]VBA Word format mergefield

I have a fieldfunction that formats a given number (price) from an excel table. 我有一个字段功能,可以从excel表中格式化给定的数字(价格)。

ie: 即:

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? 如何删除或防止在Word文件中显示空格?

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中使用的上述代码通常是如何格式化mergefield的,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM