我实际上正在尝试在MS Outlook上使用excel VB重放特定的邮件。当我使用“全部答复”功能并从excel工作表粘贴数据时,数据不会粘贴在邮件的最右上角。相反,它已与初始邮件合并。
Sub Test()
Dim olApp As Object
Dim olNs As Object
Dim Fldr As Object
Dim olMail
Dim i As Long
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1
For Each olMail In Fldr.Items
If InStr(olMail.Subject, "email message object text") <> 0 Then
with olMail.replyall
.display
set inspect = olMail.GetInspecor
set pageedit = inspect.WordEditor
' pasting data from excel(Here it does not paste on the top most left
hand corner of the mail, instead pastes data just below the mail to
which i will reply)
Activeworkbook.worksheets("Sheet1").range("XEO1048550:XEO1048560").copy
pageedit.application.selection.start = len(.body)
pageedit.application.selection.end = pageedit.application.selection.start
pageedit.application.selection.pasteandformat(wdformatplaintext)
i = i + 1
End If
Next olMail
End Sub