Date separator

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Date separator

Post by ErikJan »

Can I get the currently defined date-separator in VBA?

Sorry... found it just after I posted: application.International(xldateseparator)

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Date separator

Post by HansV »

Yes, that's the solution in Excel VBA.

In Word VBA it's similar: Application.International(wdDateSeparator)

Other Office applications such as PowerPoint, Outlook and Access don't offer built-in support to retrieve local settings. In these programs, you can get the value from the registry value HKEY_CURRENT_USER\Control Panel\International\sDate:

Dim strDateSep As String
strDateSep = CreateObject("WScript.Shell").RegRead("HKEY_CURRENT_USER\Control Panel\International\sDate")
Best wishes,
Hans