Including Commas in variable Number

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
arobin4
Junior Coder
Posts: 33
Joined: Sat Apr 07, 2012 5:41 am

Including Commas in variable Number

Post by arobin4 » Thu May 24, 2012 4:40 am

Hi Forum,
I am interesting in seeing the commas in a number when it is displayed in a dialog or message box. Is there a straightforward approach e.g., a format function?

Here is a snippet of my code:

Random>5000000,r
Let num=100000+r
MessageModal>num

The variable 'num' is displayed without any commas.

Thanks

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 24, 2012 5:37 am

Look into the vbscript function FormatNumber

Code: Select all

VBSTART
VBEND
Random>5000000,r
Let num=100000+r

VBEval>FormatNumber(%num%),res

MessageModal>res

arobin4
Junior Coder
Posts: 33
Joined: Sat Apr 07, 2012 5:41 am

Post by arobin4 » Thu May 24, 2012 6:15 am

JRL,
This is exactly what I was looking for. Thanks for pointing the VB functionality out to me.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts