Get list separator character with VBA

L

Luc Benninger

Hi
Anyone knows a way to get windows' list separator character with vba in
pp xp/2003? Is there a registry key I can read?
Thanks for any hints
Luc
 
L

Luc Benninger

No. I meant the list separator you can define in the regional options in
the control panel. In Word and Excel, there is a VBA property which
returns this separator character. But not in PowerPoint.
 
S

Shyam Pillai

Luc,

'------------------------------------------------
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

Declare Function GetUserDefaultLCID% Lib "kernel32" ()

Public Const LOCALE_SLIST = &HC


Public Sub GetListSeparator()
Dim ListSeparator As String
Dim iRetVal1 As Long
Dim iRetVal2 As Long
Dim lpLCDataVar As String

Dim Position As Integer
Dim Locale As Long

Locale = GetUserDefaultLCID()

iRetVal1 = GetLocaleInfo(Locale, LOCALE_SLIST, lpLCDataVar, 0)

ListSeparator = String$(iRetVal1, 0)

iRetVal2 = GetLocaleInfo(Locale, LOCALE_SLIST, ListSeparator,
iRetVal1)

Position = InStr(ListSeparator, Chr$(0))
If Position > 0 Then
ListSeparator = Left$(ListSeparator, Position - 1)
MsgBox "List separator is = " + ListSeparator
End If

End Sub

'-----------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top