2017-12-08 9 views
0

私のグーグル・スキルがサブ・レベルだからだと確信していますが、最後の1時間を私が見つけられなかった解決策を探すのに費やしました。Outlook 2013 VBA:すべてのテキストを選択してスペルの言語を変更するにはどうすればよいですか?

私が入力している電子メールのテキスト全体を選択し、スペルの言語を変更する短いマクロが必要です。以下はWordでは動作しますが、Outlookでは動作しません。また、VBAエディタウィンドウからツール→参照→Microsoftワード15オブジェクトライブラリを追加しました。思考?ありがとう!

Selection.WholeStory 
Selection.LanguageID = wdEnglishUK 
Selection.NoProofing = False 
Application.CheckLanguage = False 

答えて

1

1つのアプリケーションのVBA言語に固有のメソッドとプロパティは、そのような他のアプリケーションでは使用できません。

多くの情報がありますが、「Outlook VBAメッセージ本文変更言語」とその変形を検索してみてください。

一部のリソースあなたが始めるために:

+0

ありがとうございました。投稿した最初のリンクでは、.LanguageID = wdEnglishUKを動作させることができますが、.NoProofingは認識されません。 –

+0

おそらくそうではありません。あなたの質問は、**「綴りの言葉を変える」**方法を尋ねます。 – ashleedawg

+0

NoProofingは完全に関連しています。なぜなら、言語を設定してからNoProofingを有効にすると、スペルチェッカーが無効になるため、ポイント全体が無視されるからです。 VBAでOutlookでNoProofing = Falseを設定する方法について知っていますか? –

0

意図したとおりにNoProofingは動作するはずです。

Option Explicit 

Private Sub Proofing_EnglishUK() 

    Dim oMailItm As Object 
    Dim oInsp As Object 
    Dim oMailEd As Object 
    Dim oWord As Object 
    Dim Rng As Object 

    Set oInsp = ActiveInspector 

    If oInsp.currentItem.Class = olMail Then 

     Set oMailItm = oInsp.currentItem 

     If oInsp.EditorType = olEditorWord Then 

      Set oMailEd = oMailItm.GetInspector.WordEditor 
      Set oWord = oMailEd.Application 

      Set Rng = oWord.Selection 
      Rng.WholeStory 

      With Rng 

       .LanguageID = wdEnglishUK 

       ' This should work as intended 
       '.NoProofing = False 


       ' ******* temporary ************* 
       ' Check whether .NoProofing can be set 
       ' with a spelling error somewhere in the mail 
       .NoProofing = Not .NoProofing 
       If .NoProofing = False Then 
        MsgBox "Proofing on. Errors should be found." 
       Else 
        MsgBox "Proofing off. The errors will not be found." 
       End If 
       ' ******* temporary ************* 

      End With 

      oMailItm.Save 

     End If 

    End If 

    Set Rng = Nothing 
    Set oWord = Nothing 
    Set oMailEd = Nothing 
    Set oMailItm = Nothing 

End Sub 
関連する問題