code not properly functioning.
removed the setthreadlocale
added a broadcast..
xl97 and xlXP and my newsreader now properly react.
xl2003 still gives problems.. ARGHH...
I'm doing further research. will get back
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
keepITcool wrote :
as my fellow dutchman pointed out you need api's.
and I've tried to write a function for it.
the Regional settings in Control Panel ARE updated.
but I'm not sure that excel (or other proggies) are aware of it.
PLEASE LET ME KNOW and i'll figure a way !
here's a function.
It stores the user's original as a static, and changes to MM/DD
call it again and it resets to the users' original.
so be sure to call before and after your import routine.
Option Explicit
Private Const LOCALE_SSHORTDATE As Long = &H1F
Private Declare Function GetUserDefaultLCID Lib _
"kernel32.dll" () As Long
Private Declare Function GetLocaleInfo Lib "kernel32.dll" _
Alias "GetLocaleInfoA" (ByVal Locale As Long, _
ByVal LCType As Long, ByVal lpLCData As String, _
ByVal cchData As Long) As Long
Private Declare Function SetLocaleInfo Lib "kernel32" Alias _
"SetLocaleInfoA" (ByVal Locale As Long, _
ByVal LCType As Long, ByVal lpLCData As String) As Boolean
Private Declare Function SetThreadLocale Lib "kernel32.dll" ( _
ByVal Locale As Long) As Long
Function ToggleLocaleMDY() As String
Dim lPtr&, lRet&, lLen&, sData$
Static sOriginal As String
'more info:
'http://msdn.microsoft.com/library/
default.asp?url=/library/en-us/intl/nls_34rz.asp
'get the address of the user's locale
lPtr = GetUserDefaultLCID()
If sOriginal = vbNullString Then
'1st call: store and change
'prepare buffer
lLen = 256
sData = Space(lLen)
'read data
lRet = GetLocaleInfo(lPtr, LOCALE_SSHORTDATE, sData, lLen)
sOriginal = Left(sData, lLen)
lRet = SetLocaleInfo(lPtr, LOCALE_SSHORTDATE, "MM/dd/yyyy")
If lRet = 0 Then
MsgBox "can't set the date format"
Else
lRet = SetThreadLocale(lPtr)
ToggleLocaleMDY = "MM/dd/yyyy"
End If
Else
'2nd call.. reset to user's original
lRet = SetLocaleInfo(lPtr, LOCALE_SSHORTDATE, sOriginal)
If lRet = 0 Then
MsgBox "can't reset user's original date format"
Else
lRet = SetThreadLocale(lPtr)
ToggleLocaleMDY = sOriginal
sOriginal = vbNullString
End If
End If
End Function