vba word number formatting a textbox

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")
    .txtvjhjp
    .txtvjhp
    .txtabc
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
LVL 1
HakumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

Maybe

"#,##0.00"

it will normally automatically onvert to the right separators

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HakumAuthor Commented:
that worked like a charm!! awesome thank you!,

 but how about a code for more textboxes using this format?
0
Rgonzo1971Commented:
No easy way that I can think of
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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

Ron
0
aikimarkCommented:
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.
0
HakumAuthor Commented:
IrogSinta - I can't seem to fin that propety, is that in the propeties window?
0
IrogSintaCommented:
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
0
HakumAuthor Commented:
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!

Capture.PNG
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.