title: Using LOCALE_NAME_USER_DEFAULT system constant in vba
body: <h2><strong>Questions</strong></h2>
  
  <ul>
  <li>Can I use the <code>LOCALE_NAME_USER_DEFAULT</code> system constant in VBA, or do I need to use the <code>GetUserDefaultLocaleName()</code> function instead? </li>
  <li>If I can use <code>LOCALE_NAME_USER_DEFAULT</code> system constant, how do I obtain its value? </li>
  </ul>
  
  <h2><strong>Background</strong></h2>
  
  <p>I use vba to convert the system List Separator value from <code>,</code> to <code>|</code>, restart Excel, use vba to make a needed csv with the <code>|</code> separator, then restore the List Separator value to default and close Excel.</p>
  
  <p>Sometimes the list separator does not switch as expected, so now I am <a href="http://www.pcreview.co.uk/threads/get-list-separator-character-with-vba.2218762/#post-7042126" rel="nofollow noreferrer">adapting the method found here</a>
  to develop a safeguard that checks the current value to make sure it is <code>|</code>.</p>
  
  <p>Microsoft currently recommends <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd318103(v=vs.85).aspx" rel="nofollow noreferrer"> that we use the more current</a> <code>GetLocaleInfoEx()</code> instead of <code>GetLocaleInfo()</code> for interoperability purposes.</p>
  
  <p>I'm having a hard time obtaining the value of the <code>LOCALE_NAME_USER_DEFAULT</code> system constant in VBA that the documentation mentions. Here's the relevant snippet of what I have so far:</p>
  
  <pre><code>Private Const LOCALE_SLIST = &amp;HC
  Private Const LOCALE_NAME_MAX_LENGTH = 85
  'Private Const LOCALE_NAME_USER_DEFAULT &lt;-- stuck here, it wants me to declare it = to something, but I want the system value
  
  'Get Locale Info
  Private Declare Function GetLocaleInfoEx _
  Lib "kernel32" ( _
  ByVal lpLocaleName As String, _
  ByVal LCType As Long, _
  ByVal lpLCData As String, _
  ByVal cchData As Long) As Long
  
  
  Sub SubName()
  
      Dim lpLCData As String
  
          Long1 = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SLIST, lpLCData, 0)
  </code></pre>
  
  <p>Can you please help me figure out how to obtain the system constant for 
  <code>LOCALE_NAME_USER_DEFAULT</code> so I can use this function in VBA similarly to the <code>C</code> example found here:</p>
  
  <p><a href="https://stackoverflow.com/a/17674047/4691433">https://stackoverflow.com/a/17674047/4691433</a></p>