I would like to have all numbers in a macro displayed with point and not coma
For Instance This display \"0,03\" but I would like \"0.03\":
Dim MyNumber
As a first step, the three functions bellows from Kernel32 Dynamic-link library have to be declared:
Private Declare Function GetUserDefaultLCID% Lib "kernel32" ()
Private Declare Function GetLocaleInfoA Lib "kernel32" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Declare Function SetLocaleInfoA Lib "kernel32" ( ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean
The local type value for the decimals is 14 (some likes to write &HE - hexadecimal E -)
Then the program has to look like this:
' record the settings in the variable LocalSettingsDecimal
Dim LocalSettingsDecimal As String
Dim Buffer As String
Buffer = String(256, 0)
Dim le As Integer
le = GetLocaleInfoA(GetUserDefaultLCID(), 14, Buffer, Len(Buffer))
LocalSettingsDecimal = Left(Buffer, le - 1)
' force decimal settings to '.'
Call SetLocaleInfoA(GetUserDefaultLCID(), 14, ".")
' body
Dim MyNumber As Single
MyNumber = 0.03
MsgBox (MyNumber)
' set back the decimal settings
Call SetLocaleInfoA(GetUserDefaultLCID(), 14, LocalSettingsDecimal)
Let's note that, unfortunately, In case the program body fail, the settings are not restored... but this still answer the issue