Convert a text string “12345678” to nmuber in the format of “12,345,678.00”:
All important part keeped.
Dim Locale as New com.sun.star.lang.Locale
Locale.Country = "US"
Locale.Language = "en"
oCell.string = "12345678"
DataVal = CDbl(oCell.string)
FormatNumber = ThisComponent.NumberFormats.queryKey("#,##0.00", Locale, True)
oCell.value = DataVal
oCell.NumberFormat = FormatNumber
msgbox oCell.string
How can convert text "(12345678) " to number in the format of “-12,345,678.00”?
The below code can’t work.
Dim Locale as New com.sun.star.lang.Locale
Locale.Country = "US"
Locale.Language = "en"
oCell.string = "(12345678)"
DataVal = CDbl(oCell.string)
FormatNumber = ThisComponent.NumberFormats.queryKey("#,##0.00", Locale, True)
oCell.value = DataVal
oCell.NumberFormat = FormatNumber
How to fix it?