[英]Force English MonthName in VBA
My system configurations are set to Hebrew. 我的系统配置设置为希伯来语。
I want this function to return an English string: 我希望这个函数返回一个英文字符串:
MonthName(month(ActiveSheet.Range("i9").Value)))
but it returns Hebrew month name. 但它返回希伯来月份名称。
I tried to apply what works for me in excel formatting menu but it doesn't seem to work in Vba. 我尝试在excel格式菜单中应用对我有用的东西,但它似乎在Vba中不起作用。 What I tried is to add another argument:
我尝试的是添加另一个参数:
MonthName(month(ActiveSheet.Range("i9").Value)),"b1mmmm")
with no luck... 没有运气......
I will appreciate any help. 我将不胜感激任何帮助。
I'd avoid fighting the locale settings if I were you as whatever you do probably will not end up being portable. 如果我是你,我会避免与语言环境设置作斗争,因为你所做的一切可能都不会最终变得便携。
One way, and quite nice insofar that it's a spreadsheet-based solution, is to use 一种方式,并且非常好,因为它是一个基于电子表格的解决方案,是使用
=CHOOSE(,"January","February", "March", "April", ..., "December")
Where the first argument points to a number between 1 and 12. 第一个参数指向1到12之间的数字。
In VBA
you could always set up an array and index that. 在
VBA
您始终可以设置数组和索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.