對於切邊部:
If Trim(.Text) = "Since" Then .TypeText Text:= "Because"
If Trim(.Text) = "since" Then .TypeText Text:= "because"
對於大寫字母部分:
也許你可以重新格式化每對IF-THEN使用功能,像這樣:
CheckAndType("since", "because")
然後:
Function CheckAndType(origin as String, typeText as String)
If Ucase(Trim(Selection.Text)) = UCase(Trim(origin)) Then
If StrComp(Left(Selection.Text, 1), UCase(Left(Selection.Text, 1)), vbBinaryCompare) = 0 Then
Selection.TypeText Text:=LCase(typeText)
Else
Selection.TypeText Text:= UCase(Left(typeText, 1)) & LCase(Right(typeText, Len(typeText) - 1)
End If
End If
End Function
未經測試的代碼。任何懷疑/澄清,只是問。
應該是UCase(Trim(.Text))=「SINCE」 – Sorceri