Select 前景中的当前行 vba

Select current line in outlook vba

我在 outlook 中写了一个函数 vba。当我点击一封邮件并使用我的功能时,它会自动创建我的回复邮件,其中包含我用来放在回复邮件中的所有内容。

我的回复邮件是这样的:

先生您好

完成!

此致,

因为我是 bdd 管理员,我收到了很多来自邮件的任务,所以我以前只发送带有 "it's done" 的邮件。

但有时,我使用自动回复来回复一封普通邮件,其中不包含任何类型的任务。所以我必须在写回复之前从我的回复邮件中手动删除"it's done"。

使用"SendKeys"功能,我的光标自动放在"It's done"行,但现在我试图自动select这一行。因为如果这一行已经 selected,我只需要写一些东西来替换 "It's done",或者如果我只想发送 "It's done",我可以像这样发送邮件。

但我寻找了 "Select text in vba outlook" 或 "Select row" 甚至 "select sentence" 和 "select line",我没有找到解决我的问题的明确方法。我该怎么做?

此致。

好的,我找到了如何做到这一点:

    Dim objOL As Outlook.Application
        Dim objNS As Outlook.NameSpace
        Dim objDoc As Word.Document
        Dim objSel As Word.Selection

    Set objOL = Application
        If objOL.ActiveInspector.EditorType = olEditorWord Then
            Set objDoc = objOL.ActiveInspector.WordEditor
            Set objNS = objOL.Session

            Set objSel = objDoc.Windows(1).Selection
            objSel.MoveEnd Unit:=wdLine, Count:=1

        End If
    Set objOL = Nothing
    Set objNS = Nothing

感谢您的关注!