|
-
Dec 19th, 2005, 05:00 PM
#1
Thread Starter
Lively Member
[RESOLVED] Missing decimal places in Userform textbox (Word 2003)
Within my userform there are some text boxes that require a price input. However, I want to set it up so that if a user enters, for example, "950", it will be converted to "950.00" (including decimal places).
Here's what I have:
VB Code:
Private Sub txtPrice_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'SELLING PRICE ENTRY FORMAT VALIDATION
If IsNumeric(txtPrice.Value) Then
txtPrice.Value = Format(CLng(txtPrice.Value), "#,###.##")
Else
MsgBox "Please enter a valid selling price!", vbExclamation + vbOKOnly, "Invalid Price Format!"
txtPrice.Value = Null
Cancel = True
End If
End Sub
Using this code, if I enter "950", I get "950." (it shows the decimal point, but nothing else after that). I also lose the the trailing zeros even if I enter them. For example, I enter "950.00", but again get "950".
I know there is a currency format that can be used, but I had problems with that as well and believe that the currency format relies on regional settings, which I don't want to do.
I also considered FormatNumber, but my userform may be used in Word 97, which apparently doesn't support this function?
Any help would be appreciated (and probably relieve my headache).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|