vba word number formatting a textbox

Hakum used Ask the Experts™
Hi again experts,

Another quick question, i'm trying to find a way to format a few userform textbox's but no luck its for formatting it incorrect.

this is the code:

Private Sub txtvjhjp_AfterUpdate()

txtvjhjp.Text = Format(txtvjhjp.Value, "#.##0,00")

End Sub

Open in new window

The result is this: 7000,0000
when it should be this: 7.000,00

I'm also looking for a way to do it easier, there is a few textboxes that need this format is there an easier way, like simply right the textbox name on a list and it will put the form in them all, something like this:

Private Sub decimalseparator_AfterUpdate()

Format(value, "#.##0,00")
End Sub

Open in new window

no clue if this is possible at all but would make it easier and the code would be more clean i guess :)

thank you in advance
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016



it will normally automatically onvert to the right separators



that worked like a charm!! awesome thank you!,

 but how about a code for more textboxes using this format?
Top Expert 2016

No easy way that I can think of
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

You can just select all the textboxes together (using the Ctrl key) then just insert the following in the FORMAT property:

Top Expert 2014

You have to make a translation when coding formats in countries where the decimal symbol is a comma and the thousands separator is a period.


IrogSinta - I can't seem to fin that propety, is that in the propeties window?
It's the topmost property in the Format tab of the Property Sheet. If you put #,##0.00 in there it will automatically change to Standard

property sheet


Sadly i think this function is only available in access or so, im try to code this in word vba so its not there.

But thanks!


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial