VBScript Outlook 2016从特定IMAP帐户发送新邮件
在Outlook 2013之前,我能够通过宏使用特定的IMAP帐户发送新邮件 自Outlook 2016以来,我收到一条错误消息: 运行时错误“9”:下标超出范围 代码如下:VBScript Outlook 2016从特定IMAP帐户发送新邮件,vbscript,outlook,Vbscript,Outlook,在Outlook 2013之前,我能够通过宏使用特定的IMAP帐户发送新邮件 自Outlook 2016以来,我收到一条错误消息: 运行时错误“9”:下标超出范围 代码如下: Sub createMailIMAP() Dim MyMail As MailItem, _ olkInspector As Outlook.Inspector, _ olkSendThroughBtn As CommandBarPopup, _ olkSendAcc
Sub createMailIMAP()
Dim MyMail As MailItem, _
olkInspector As Outlook.Inspector, _
olkSendThroughBtn As CommandBarPopup, _
olkSendAccount As CommandBarButton
Set MyMail = Application.CreateItem(olMailItem)
MyMail.BodyFormat = olFormatPlain
MyMail.Body = ""
MyMail.Display
Set olkSendThroughBtn = Application.ActiveInspector.CommandBars("Standard").Controls(3)
Set olkSendAccount = olkSendThroughBtn.Controls(2)
olkSendAccount.Execute
End Sub
注意事项:outlook配置了Exchange帐户,并且有一个额外的共享邮箱
Outlook 2016是否不推荐使用此代码?
干杯
poy.控件集合现在为空(
Controls.Count
==0)。-Outlook 2016使用色带
改为设置MailItem.SendUsingAccount
属性