✔ 最佳答案
系唔系甘樣:
Dim strTest As String
Dim i As Integer
Dim strStored As String
strTest = "Hello,World"
MsgBox "String length=" & Len(strTest), vbInformation, strTest
For i = 1 To Len(strTest)
Store = MsgBox("The " & i & StNdRdTh(i) & " character is " & Mid$(strTest, i, 1) & vbCrLf & "Store it?", vbYesNo, "Store Value")
If Store = vbYes Then
strStored = strStored & Mid$(strTest, i, 1)
End If
Next
MsgBox Len(strStored) & "word(s) stored :" & vbCrLf & strStored
'自己寫左個Function轉th、st果D
Function StNdRdTh(n As Integer) As String
If n = 11 Or n = 12 Or n = 13 Then
StNdRdTh = "th"
Exit Function
Else
Select Case Right$(CStr(n), 1)
Case 1
StNdRdTh = "st"
Case 2
StNdRdTh = "nd"
Case 3
StNdRdTh = "rd"
Case Else
StNdRdTh = "th"
End Select
End If
End Function