Outlook 2013 VBA:如何选择所有文本并更改拼写语言?

时间:2017-12-08 16:48:31

标签: vba outlook-vba outlook-2013

我确信这是因为我的谷歌搜索技能低于标准,但我花了最后一小时寻找一个我找不到的解决方案。

我需要一个简短的宏来选择我输入的电子邮件中的整个文本,并更改​​拼写语言。以下适用于Word,但在Outlook中不起作用。我还添加了工具 - >参考 - > Microsoft Word 15 VBA编辑器窗口中的对象库。思考?谢谢!

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

2 个答案:

答案 0 :(得分:1)

特定于某个应用程序的VBA语言的方法和属性不能用于其他类似的应用程序。

有很多信息,请尝试搜索“ Outlook VBA更改邮件正文语言”及其变体。

帮助您入门的一些资源:

答案 1 :(得分: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