【问题标题】:olMailItem - ReplyRecipients.AddolMailItem - 回复收件人。添加
【发布时间】:2022-04-29 11:59:01
【问题描述】:

我在 MS Access 2013 中尝试使用 Outlook 2013 为 olMailItem 设置回复地址。

我当前的代码给了我:

运行时错误“287” 应用程序定义或对象定义的错误

Private Sub email_button_click()

' *** SETUP OUTLOOK ***
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olMailItem)

' *** DO SOME OTHER STUFF ****
....

With OutMail
    .Subject = "Test"
    .Body = "Whatever"
    .To = "test@test.com"
    .ReplyRecipients.Add "notatest@test.com"    <- Error here
    .Display
End With

' *** TIDY UP ***
Set OutMail = Nothing
Set OutApp = Nothing

End Sub

很多其他人似乎都能做到。即:

Change reply address in Outlook mail

http://www.ozgrid.com/forum/showthread.php?t=186882

http://www.vbaexpress.com/forum/archive/index.php/t-19993.html

谢谢

道格

【问题讨论】:

  • 您想将某人添加到 CC 中吗?如果你是,你可以使用 Outmail.CC = "Email@Something.com"
  • @RyanWildry:“正在尝试设置回复地址”

标签: ms-access outlook vba ms-access-2013


【解决方案1】:

我在 Outlook VBA 或 OutlookSpy(我是它的作者)脚本编辑器中运行以下脚本绝对没有问题。

Set OutMail = Application.CreateItem(olMailItem)
With OutMail
    .Subject = "Test"
    .Body = "Whatever"
    .To = "test@test.com"
    .ReplyRecipients.Add "notatest@test.com"
    .Display
End With

如果 Outlook 没有运行,请确保调用 Namespace.Logon:

set ns = Application.GetNamespace("MAPI")
ns.Logon

【讨论】:

    【解决方案2】:

    我在一个企业系统上看到过这种情况,其中组策略阻止 Outlook 2013 上的 VBA 脚本。

    解决方法是关闭 GP。

    【讨论】:

      【解决方案3】:

      再列出一次,你是在“添加”收件人

         .ReplyRecipients.Add "notatest1@test.com"
         .ReplyRecipients.Add "notatest2@test.com"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-05-14
        • 2018-05-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-15
        • 2019-09-28
        • 1970-01-01
        相关资源
        最近更新 更多