如何在电子邮件正文中的特定单词后移动光标 [英] How to move cursor after a specific word in email body

查看:42
本文介绍了如何在电子邮件正文中的特定单词后移动光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了这段代码来将 Outlook 光标向右移动 5 个字:

选项显式公共子示例()Dim Inspector 作为 Outlook.Inspector将 wdDoc 变暗为 Word.DocumentDim 选择作为 Word.Selection设置 Inspector = Application.ActiveInspector()设置 wdDoc = Inspector.WordEditor设置选择 = wdDoc.Application.SelectionSelection.MoveRight 单位:=wdCharacter,计数:=5,扩展:=wdMove设置检查员 = 无设置 wdDoc = 无设置选择 = 无结束子

您知道如何在电子邮件正文中的特定单词后移动鼠标光标吗?谢谢

解决方案

使用

I wrote this code to move Outlook cursor 5 words to right:

Option Explicit
Public Sub Example()
    Dim Inspector As Outlook.Inspector
    Dim wdDoc As Word.Document
    Dim Selection As Word.Selection
Set Inspector = Application.ActiveInspector()
    Set wdDoc = Inspector.WordEditor
    Set Selection = wdDoc.Application.Selection
        Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdMove
Set Inspector = Nothing
    Set wdDoc = Nothing
    Set Selection = Nothing
End Sub

Do you have any idea how to move mouse cursor after a specific word in email body? Thank you

解决方案

Work with Find.Execute method MSDN Find the word then move the cursor

Option Explicit
Public Sub Example()
    Dim Inspector As Outlook.Inspector
    Dim wdDoc As Word.Document
    Dim Selection As Word.Selection

    Set Inspector = Application.ActiveInspector()
    Set wdDoc = Inspector.WordEditor
    Set Selection = wdDoc.Application.Selection

    With Selection.Find
        .MatchWildcards = False
        .Text = "word"
        .Execute
    End With

    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove

End Sub

这篇关于如何在电子邮件正文中的特定单词后移动光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆