Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA cDate not working on Mac excel 2011(14.7.1)

Tags:

I am trying to convert a date into long using VBA script. Below is the code snippet

Sub test()
    Dim str as string
    Dim d as variant
    str="1/1/2016"
    d=cdate(str)
end sub

The above snippet runs fine on windows but is giving me type mismatch error on MAC. Is there any turnaround to convert a valid string in a date.

like image 808
Rohit Saluja Avatar asked Jan 19 '17 09:01

Rohit Saluja


1 Answers

Your regional settings are the root cause.

Can you try modify them?

defaults write NSGlobalDomain AppleICUDateFormatStrings -dict 1 dd/MM/yyyy
like image 111
Jeandey Boris Avatar answered Sep 24 '22 10:09

Jeandey Boris