gpt4 book ai didi

vba - Outlook 2013 使用 VBA 发送草稿

转载 作者:行者123 更新时间:2023-12-04 03:30:37 32 4
gpt4 key购买 nike

早上好,

我使用 Outlook 2010 编译代码以发送保存在给定帐户的草稿文件夹中的所有电子邮件。现在我已经升级到 Office 2013 我收到一个错误......它是 .Send 位,它失败并显示错误消息:

“此方法不能与内联响应邮件项目一起使用。”

我确信有一种发送草稿的简单方法,但我已经在网上搜索过,但目前还无法弄清楚。

Public Sub SendDrafts()

Dim lDraftItem As Long
Dim myOutlook As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolders As Outlook.Folders
Dim myDraftsFolder As Outlook.MAPIFolder

'Send all items in the "Drafts" folder that have a "To" address filled

'Setup Outlook

Set myOutlook = Outlook.Application
Set myNameSpace = myOutlook.GetNamespace("MAPI")
Set myFolders = myNameSpace.Folders

'Set Draft Folder. This will need modification based on where it's


Set myDraftsFolder = myFolders("accounts@credec.co.uk").Folders("Drafts")

'Loop through all Draft Items

For lDraftItem = myDraftsFolder.Items.count To 1 Step -1

'Check for "To" address and only send if "To" is filled in.

If Len(Trim(myDraftsFolder.Items.Item(lDraftItem).To)) ] 0 Then

'Send Item

myDraftsFolder.Items.Item(lDraftItem).Send

End If
Next lDraftItem

'Clean-up

Set myDraftsFolder = Nothing
Set myNameSpace = Nothing
Set myOutlook = Nothing

End Sub

最佳答案

我知道这是旧的,但万一其他人正在寻找答案:

“事件内联响应”是指在 Outlook 中打开的草稿。因此,在调试时,请关闭草稿并翻回另一条消息。然后看看你的代码是否会运行。

关于vba - Outlook 2013 使用 VBA 发送草稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17401378/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com