text format_data,2018年2月7日

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text format_data,2018年2月7日相关的知识,希望对你有一定的参考价值。

Sub format_data()
Dim strtemp
Dim arr
If InStr(selection.Text, ",") > 0 And InStr(selection.Text, "-") > 0 Then
strtemp = Replace(Replace(selection.Text, ",", ""), "-", ChrW(8211))
End If
If InStr(selection.Text, ",") = 0 And InStr(selection.Text, "-") > 0 Then
strtemp = Replace(selection.Text, "-", ChrW(8211))


End If
If InStr(selection.Text, ",") > 0 And InStr(selection.Text, "-") = 0 Then

strtemp = Replace(selection.Text, ",", "")

End If
If InStr(selection.Text, ",") = 0 And InStr(selection.Text, "-") = 0 Then

strtemp = selection.Text

End If

arr = Split(strtemp, " ")
If IsNumeric(Left(arr(0), 1)) = True Then
Select Case Left(arr(1), 3)
Case "Jan"
arr(1) = "January"
Case "Feb"
arr(1) = "February"
Case "Mar"
arr(1) = "March"
Case "Apr"
arr(1) = "April"
Case "May"
arr(1) = "May"
Case "Jun"
arr(1) = "June"
Case "Jul"
arr(1) = "July"
Case "Aug"
arr(1) = "August"
Case "Sep"
arr(1) = "September"
Case "Oct"
arr(1) = "October"
Case "Nov"
arr(1) = "November"
Case "Dec"
arr(1) = "December"
End Select

selection.Text = arr(0) & " " & arr(1) & " " & arr(2)
Else
Select Case Left(arr(0), 3)
Case "Jan"
arr(0) = "January"
Case "Feb"
arr(0) = "February"
Case "Mar"
arr(0) = "March"
Case "Apr"
arr(0) = "April"
Case "May"
arr(0) = "May"
Case "Jun"
arr(0) = "June"
Case "Jul"
arr(0) = "July"
Case "Aug"
arr(0) = "August"
Case "Sep"
arr(0) = "September"
Case "Oct"
arr(0) = "October"
Case "Nov"
arr(0) = "November"
Case "Dec"
arr(0) = "December"
End Select

selection.Text = arr(1) & " " & arr(0) & " " & arr(2)
End If
End Sub

以上是关于text format_data,2018年2月7日的主要内容,如果未能解决你的问题,请参考以下文章

text 查尾跑完以后缺失的文献2018年7月2日

text 字典嵌套2018年2月8日

text 进度条应用2018年2月8日

text 插入照片调整尺寸:2018年2月8日

text 整体读取文本文件:2018年2月8日

text 按行读取文本文件:2018年2月8日