Public Function ENGTONUM(cs As String) As String
Const initstr = "01JAN,02FEB,03MAR,04APR,05MAY,06JUN,07JUL,08AUG,09SEP,10OCT,11NOV,12DEC,"
Dim i As Long, j As String
ENGTONUM = "Err!"
'默认为错误
j = UCase(cs)
'转大写
If Len(j) = 5 Then
'限制为 三字母+2数字模式
i = InStr(1, initstr, Left(j, 3) & ",")
'找内容
If i > 0 Then
'找到
ENGTONUM = Mid(initstr, i - 2, 2) & Right(j, 2)
'取值
End If
End If
End Function
调用:print ENGTONUM("OCT20")