View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jean grey jean grey is offline
external usenet poster
 
Posts: 19
Default GetLocaleInfo Automation Error

I know now where the prob was. I forgot to put ByVal in lpLCData parameter.

"jean grey" wrote:

Hi everyone. In this code, when it reaches the line GetLocaleInfo, it displays

Run-time error '2147417848' Automation Error The object invoked has
disconnected from its clients.

Could somebody please tell me what's wrong?
I'm using WinXP, MS Excel 2003.
Thanks in advance!


Private Const LOCALE_SSHORTDATE As Long = &H1F

Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long

Private Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
lpLCData As String, _
ByVal cchData As Long) As Long

Private Sub GetInfo

Dim lcid As Long

lcid = GetSystemDefaultLCID()

Dim format As String

Dim temp As Long

temp = GetLocaleInfo(lcid, LOCALE_SSHORTDATE, format, 256)

End Sub