VBA-Seleccione o texto no corpo de E-mail do Outlook

Abaixo está uma imagem:

enter image description here

actualmente, tenho o seguinte código:

Sub Mail()
    Dim wb As Workbook, sh As Worksheet
    Set wb = Workbooks("book1"): Set sh = wb.Sheets("Sheet1")
    Dim OutApp As Object
    Dim OutMail As Object
    Dim msgbody As String

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
        .To = ""
        .CC = ""
        .BCC = ""
        .Subject = "subjsect"
        .Body = "somerandomtexthererhejoiehtjejheirjgoejrgijewr+goehjpogerhgeirog stackoverflow"
        .Display 
    End With
    Set weditor = OutApp.ActiveInspector.wordEditor
    On Error GoTo 0

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

Eu acredito que a linha de chave é

    Set weditor = OutApp.ActiveInspector.wordEditor
Porque me permite manipular o corpo como se fosse uma palavra. Eu só não consigo que ele Procure e selecione o texto que eu quero ser selecionado (como stackoverflow na imagem acima).

Author: docjay, 2014-08-25

1 answers

Para obter o item actualmente em aberto no seu Outlook, tudo o que precisa é:

Dim OutApp As Object
Dim OutMail As Object
Dim msgbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.ActiveInspector.CurrentItem
msgbody = OutMail.Body
' if you want to edit the body - OutMail.Body = "BOB" for example!
' search and editing code goes here...

Set OutMail = Nothing
Set OutApp = Nothing
 0
Author: Captain, 2014-08-25 10:23:03