VBA cDate在Mac上不工作excel 2011(14.7.1) [英] VBA cDate not working on Mac excel 2011(14.7.1)
本文介绍了VBA cDate在Mac上不工作excel 2011(14.7.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用VBA脚本将日期转换为长时间。
以下是代码片段
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
上面的代码段在Windows上运行正常,但在MAC上给出了类型不匹配错误。
转换日期中有效的字符串是否有任何转变。
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.
推荐答案
您的区域设置是根本原因。
Your regional settings are the root cause.
你可以尝试修改它们吗?
Can you try modify them?
defaults write NSGlobalDomain AppleICUDateFormatStrings -dict 1 dd/MM/yyyy
这篇关于VBA cDate在Mac上不工作excel 2011(14.7.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文