在VBA中强制英文月份名称 [英] 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.
我尝试在excel格式化菜单中应用对我有用的功能,但在Vba中似乎不起作用。
我尝试的是添加另一个参数:
I tried to apply what works for me in excel formatting menu but it doesn't seem to work in Vba. What I tried is to add another argument:
MonthName(month(ActiveSheet.Range("i9").Value)),"b1mmmm")
没有运气...
我会感谢任何帮助。
推荐答案
如果我是你作为任何你可能不会最终不可移植。
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")
第一个参数指向1到12之间的数字。
Where the first argument points to a number between 1 and 12.
在 VBA
中,您可以随时设置一个数组和索引。
In VBA
you could always set up an array and index that.
这篇关于在VBA中强制英文月份名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!