VB and VBA Users Source Code: Returning the users decimal and thousand separator
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Returning the users decimal and thousand separator
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Wednesday, September 19, 2001
Hits:
1005
Category:
Windows API
Article:
The following functions return the users decimal point/seperator and thousand separator. Private Declare Function GetLocaleInfo& Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) Private Const LOCALE_SDECIMAL As Long = &HE Private Const LOCALE_STHOUSAND As Long = &HF Private Const LOCALE_USER_DEFAULT As Long = &H400 'Purpose : Returns a the current users thousand separator 'Inputs : N/A 'Outputs : Returns a the current users thousand separator 'Author : Andrew Baker 'Date : 19/Sep/2001 15:50 Function ThousandSeparator() As String Dim lRetVal As Long, sRes As String * 10 lRetVal = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, sRes, 10) ThousandSeparator = Left$(sRes, lRetVal) End Function 'Purpose : Returns a the current users decimal separator 'Inputs : N/A 'Outputs : Returns a the current users decimal separator 'Author : Andrew Baker 'Date : 19/Sep/2001 15:50 Function DecimalSeparator() As String Dim lRetVal As Long, sRes As String * 10 lRetVal = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, sRes, 10) DecimalSeparator = Left$(sRes, lRetVal) End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder