#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Date format

Hi,

how can I know what the default date and time format is set on the user's
computer. Now I set it to a special format (yy-mm-dd) but the user asks to
let it be like his computer's setting.

Thanks
Jos Vens


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Date format

If you just put a date in an unformatted cell, it should use the default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the user's
computer. Now I set it to a special format (yy-mm-dd) but the user asks to
let it be like his computer's setting.

Thanks
Jos Vens




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Date format

Thanks Tom,

but: if i use your code, I get 05-10-29 in my cell (my systemsetting is
jj-MM-dd)
but ?activecell.numberformat gives me "m/d/yyyy", which is not my
systemsetting.

Can you still help me?
Jos


"Tom Ogilvy" schreef in bericht
...
If you just put a date in an unformatted cell, it should use the default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the user's
computer. Now I set it to a special format (yy-mm-dd) but the user asks
to
let it be like his computer's setting.

Thanks
Jos Vens






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Date format

Jens,

Try NumberFormatLocal instead.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jos Vens" wrote in message
...
Thanks Tom,

but: if i use your code, I get 05-10-29 in my cell (my systemsetting is
jj-MM-dd)
but ?activecell.numberformat gives me "m/d/yyyy", which is not my
systemsetting.

Can you still help me?
Jos


"Tom Ogilvy" schreef in bericht
...
If you just put a date in an unformatted cell, it should use the default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the

user's
computer. Now I set it to a special format (yy-mm-dd) but the user asks
to
let it be like his computer's setting.

Thanks
Jos Vens








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Date format

Jos,

Apologies for the wrong name, I was watching Jens Lehmann on the TV

Bob


"Bob Phillips" wrote in message
...
Jens,

Try NumberFormatLocal instead.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jos Vens" wrote in message
...
Thanks Tom,

but: if i use your code, I get 05-10-29 in my cell (my systemsetting is
jj-MM-dd)
but ?activecell.numberformat gives me "m/d/yyyy", which is not my
systemsetting.

Can you still help me?
Jos


"Tom Ogilvy" schreef in bericht
...
If you just put a date in an unformatted cell, it should use the

default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the

user's
computer. Now I set it to a special format (yy-mm-dd) but the user

asks
to
let it be like his computer's setting.

Thanks
Jos Vens












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date format

Hi Jens,

Try:
'=================
Function SettingVaL(strSetting As String)
Dim strComputer As String
Dim strKeyPath As String
Dim strEntryName As Variant
Dim strValue As String
Dim strLogFile As String
Dim objReg As Object
Dim objFSO As Object
Dim arrValue, byteValue, arrEntryNames, arrValueTypes


Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_USER = &H80000001
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7


strKeyPath = ".DEFAULT\Control Panel\International"
strLogFile = "C:\RegionalSettings.txt"


Set objFSO = CreateObject("Scripting.FileSystemObject")
''Set objLogFile = objFSO.CreateTextFile(strLogFile)
'''objLogFile.Writeline ("This logfile was made on " _
& Date & " at " & Time & "." & VbCrLf )

strComputer = "."

' Connect to the WMI Regisitry-provider
Set objReg = GetObject("winmgmts:{impersonationLevel" _
& "=impersonate}!\\" & strComputer _
& "\root\default:StdRegProv")

objReg.EnumValues HKEY_USERS, strKeyPath, _
arrEntryNames, arrValueTypes
For Each strEntryName In arrEntryNames
'*** This is the only Binary value
If strEntryName = "DefaultBlindDialFlag" Then
objReg.GetBinaryValue HKEY_USERS, strKeyPath, _
strEntryName, arrValue

For Each byteValue In arrValue
If strEntryName = "s" & strSetting Then
SettingVaL = strValue
Exit Function
End If
Next
Else
'*** These are all RegSZ value's
objReg.GetStringValue HKEY_USERS, strKeyPath, _
strEntryName, strValue
If strEntryName = "s" & strSetting Then
SettingVaL = strValue
Exit Function
End If

End If
Next

End Function
'<<=================

'=================
Sub GetDateFormat()
Dim ShortDt As String
Dim LongDt As String

ShortDt = SettingVaL("ShortDate")
LongDt = SettingVaL("LongDate")

MsgBox ShortDt & vbNewLine & LongDt
End Sub
'<<=================

---
Regards,
Norman



"Jos Vens" wrote in message
...
Thanks Tom,

but: if i use your code, I get 05-10-29 in my cell (my systemsetting is
jj-MM-dd)
but ?activecell.numberformat gives me "m/d/yyyy", which is not my
systemsetting.

Can you still help me?
Jos


"Tom Ogilvy" schreef in bericht
...
If you just put a date in an unformatted cell, it should use the default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the
user's
computer. Now I set it to a special format (yy-mm-dd) but the user asks
to
let it be like his computer's setting.

Thanks
Jos Vens








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Date format

Thanks Bob,

it is really what I'm looking for

Thanks Norman for your code I may use later maybe,

Greetings
Jos


"Bob Phillips" schreef in bericht
...
Jens,

Try NumberFormatLocal instead.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jos Vens" wrote in message
...
Thanks Tom,

but: if i use your code, I get 05-10-29 in my cell (my systemsetting is
jj-MM-dd)
but ?activecell.numberformat gives me "m/d/yyyy", which is not my
systemsetting.

Can you still help me?
Jos


"Tom Ogilvy" schreef in bericht
...
If you just put a date in an unformatted cell, it should use the
default
date

activecell.Value = Date
? activeCell.NumberFormat
m/d/yy
ActiveCell.Offset(1,0).Value = Time
? activeCell.Offset(1,0).Numberformat
h:mm:ss AM/PM


--
Regards,
Tom Ogilvy



"Jos Vens" wrote in message
...
Hi,

how can I know what the default date and time format is set on the

user's
computer. Now I set it to a special format (yy-mm-dd) but the user
asks
to
let it be like his computer's setting.

Thanks
Jos Vens










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
How do I convert dd/mm/yy date format to yyddd Julian date format itzy bitzy[_2_] Excel Worksheet Functions 8 December 11th 09 03:20 AM
Convert date + time text format to date format Paul Ho Excel Worksheet Functions 2 May 22nd 07 05:47 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 04:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"