GetLocaleInfo Automation Error

J

jean grey

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
 

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