1
私の翻訳コードは私が望むように機能しません...セルの最初の単語でのみPropercaseを実行する必要がありますが、セル内のすべての単語で適切なケースを実行しています。VBA propercase in language translation code fix
どのように翻訳を行い、activecellの最初の単語にのみpropercaseを使用するかに関するアイデアはありますか?ここで
は、コードは次のとおりです。
Sub traducaobeta2()
Dim translate As Object 'scritping.Dictionary
Set translate = CreateObject("Scripting.Dictionary")
translate("cadeira") = "chair"
translate("cadeira,") = "chair"
translate("cadeiras") = "chairs"
translate("criado mudo") = "night stand"
translate("criado-mudo") = "night stand"
translate("mesa") = "table"
translate("mesas") = "tables"
translate("e") = "and"
' the list goes on...
Dim Words As Variant
Dim I As Integer
Words = Split(LCase(activecell.Value))
For I = LBound(Words) To UBound(Words)
If translate(Words(I)) <> "" Then Words(I) = translate(Words(I))
Next
activecell.Value = Join(Words)
For Each x In activecell
x.Value = Application.Proper(x.Value)
Next
activecell.Offset(0, 1).Select
End Sub
あなたが適用できます辞書の正しいケーシングと、StrComp()を使用して大文字小文字を区別しない同値性をテストする –