Attribute VB_Name = "MdlCommon"
Option Explicit

'Code issu du snippet : http://www.codyx.org/snippet_modifier-separateur-decimale-options-regionales-linguistiques_264.aspx

'Déclaration des fonctions API
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCTYPE As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCTYPE As Long, ByVal lpLCData As String) As Long
Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Long

'Déclaration de la constante séparateur décimal
Private Const LOCALE_SDECIMAL = &HE

Public Property Get DecimalSeparator() As String
Dim nLength As Long
Dim nLocale As Long
    nLocale = GetUserDefaultLCID()
    nLength = GetLocaleInfo(nLocale, LOCALE_SDECIMAL, vbNullString, 0) - 1
    DecimalSeparator = Space$(nLength)
    GetLocaleInfo nLocale, LOCALE_SDECIMAL, DecimalSeparator, nLength
End Property

Public Property Let DecimalSeparator(ByRef Value As String)
Dim nLocale As Long
    If Value <> DecimalSeparator Then
        If Value = "." Or Value = "," Then
            nLocale = GetUserDefaultLCID()
            SetLocaleInfo nLocale, LOCALE_SDECIMAL, Value
        End If
    End If
End Property
