Formatting Numbers

From Microstation VBA Wiki
Revision as of 21:23, 12 August 2010 by Ted (talk | contribs) (Created page with 'The best way to format numbers for output is to use the Format() function. It seems to work fine on either a string that looks like a number or just a regular number. Here is a …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The best way to format numbers for output is to use the Format() function. It seems to work fine on either a string that looks like a number or just a regular number.

Here is a simple use of Format() to show two decimal places:

strText = "EL. " & Format(elev, "###0.00")
EL. 1040.25

Stationing in surveying puts a separator after the hundreds marker so you can generate the proper format with this statement:

strText = "STA. " & Format(sta, "##+#0.00")
STA. 35+52.00