如何在Outlook中一次發送多個草稿?
如果您的“草稿”文件夾中有多個草稿郵件,而現在,您希望一次發送一次而不要一一發送。 您如何在Outlook中快速輕鬆地處理這項工作?
使用VBA代碼一次在Outlook中發送所有草稿郵件
以下VBA代碼可以幫助您立即發送“草稿”文件夾中的所有或選定的草稿電子郵件,請這樣做:
1。 按住 ALT + F11 鍵打開 Microsoft Visual Basic for Applications 窗口。
2。 然後點擊 插入 > 模塊,將以下代碼複製並粘貼到打開的空白模塊中,請參見屏幕截圖:
VBA代碼:在Outlook中一次發送所有草稿電子郵件:
Sub SendAllDraftEmails()
Dim xAccount As Account
Dim xDraftFld As Folder
Dim xItemCount As Integer
Dim xCount As Integer
Dim xDraftsItems As Outlook.Items
Dim xPromptStr As String
Dim xYesOrNo As Integer
Dim i As Long
Dim xCurFld As Folder
Dim xTmpFld As Folder
On Error Resume Next
xItemCount = 0
xCount = 0
Set xTmpFld = Nothing
Set xCurFld = Application.ActiveExplorer.CurrentFolder
For Each xAccount In Outlook.Application.Session.Accounts
Set xDraftFld = xAccount.DeliveryStore.GetDefaultFolder(olFolderDrafts)
xItemCount = xItemCount + xDraftFld.Items.Count
If xDraftFld.EntryID = xCurFld.EntryID Then
Set xTmpFld = xCurFld.Parent
End If
Next xAccount
Set xDraftFld = Nothing
If xItemCount > 0 Then
xPromptStr = "Are you sure to send out all the drafts?"
xYesOrNo = MsgBox(xPromptStr, vbQuestion + vbYesNo, "Kutools for Outlook")
If xYesOrNo = vbYes Then
If Not xTmpFld Is Nothing Then
Set Application.ActiveExplorer.CurrentFolder = xTmpFld
End If
VBA.DoEvents
For Each xAccount In Outlook.Application.Session.Accounts
Set xDraftFld = xAccount.DeliveryStore.GetDefaultFolder(olFolderDrafts)
Set xDraftsItems = xDraftFld.Items
For i = xDraftsItems.Count To 1 Step -1
If xDraftsItems.Item(i).Recipients.Count <> 0 Then
xDraftsItems.Item(i).sEnd
xCount = xCount + 1
End If
Next
Next xAccount
VBA.DoEvents
Set Application.ActiveExplorer.CurrentFolder = xCurFld
MsgBox "Successfully sent " & xCount & " messages", vbInformation, "Kutools for Outlook"
End If
Else
MsgBox "No Drafts!", vbInformation + vbOKOnly, "Kutools for Outlook"
End If
End Sub
3。 然後保存代碼,然後按 F5 鍵以運行此代碼,將彈出一個提示框,提醒您是否發送所有草稿,請單擊 是,請參見屏幕截圖:
4。 然後會彈出一個對話框,提醒您已發送了多少電子郵件草稿,請參見屏幕截圖:
5。 然後點擊 OK 按鈕中的所有電子郵件 草稿 文件夾將立即發送,請參見屏幕截圖:
筆記:
1.上面的代碼將發送Outlook中所有帳戶的所有電子郵件草稿。
2.如果您只想從“草稿”文件夾發送一些特定的電子郵件,請應用以下VBA代碼:
VBA代碼:從“草稿”文件夾發送選定的電子郵件:
Sub SendSelectedDraftEmails()
Dim xSelection As Selection
Dim xPromptStr As String
Dim xYesOrNo As Integer
Dim i As Long
Dim xAccount As Account
Dim xCurFld As Folder
Dim xDraftsFld As Folder
Dim xTmpFld As Folder
Dim xArr() As String
Dim xCount As Integer
Dim xMail As MailItem
On Error Resume Next
xCount = 0
Set xTmpFld = Nothing
Set xCurFld = Application.ActiveExplorer.CurrentFolder
For Each xAccount In Outlook.Application.Session.Accounts
Set xDraftsFld = xAccount.DeliveryStore.GetDefaultFolder(olFolderDrafts)
If xDraftsFld.EntryID = xCurFld.EntryID Then
Set xTmpFld = xCurFld.Parent
End If
Next xAccount
If xTmpFld Is Nothing Then
MsgBox "The current folder is not a draft folder", vbInformation, "Kutools for Outlook"
Exit Sub
End If
Set xSelection = Outlook.Application.ActiveExplorer.Selection
If xSelection.Count > 0 Then
xPromptStr = "Are you sure to send out the selected " & xSelection.Count & " draft item(s)?"
xYesOrNo = MsgBox(xPromptStr, vbQuestion + vbYesNo, "Kutools for Outlook")
If xYesOrNo = vbYes Then
ReDim xArr(xSelection.Count - 1)
For i = 1 To xSelection.Count
xArr(i - 1) = xSelection.Item(i).EntryID
Next
Set Application.ActiveExplorer.CurrentFolder = xTmpFld
VBA.DoEvents
For i = 0 To UBound(xArr)
Set xMail = Application.Session.GetItemFromID(xArr(i))
If xMail.Recipients.Count <> 0 Then
xMail.sEnd
xCount = xCount + 1
End If
Next
VBA.DoEvents
Set Application.ActiveExplorer.CurrentFolder = xCurFld
MsgBox "Successfully sent " & xCount & " messages", vbInformation, "Kutools for Outlook"
End If
Else
MsgBox "No items selected!", vbInformation, "Kutools for Outlook"
End If
End Sub
相關文章:
如何通過Outlook從Excel向列表發送個性化大量電子郵件?
如何在Outlook中未知的情況下向多個收件人發送電子郵件?
Kutools for Outlook-為Outlook帶來100個高級功能,並使工作更加輕鬆!
- 自動CC / BCC 根據規則發送電子郵件; 自動前進 自定義多封電子郵件; 自動回复 沒有交換服務器,還有更多自動功能...
- BCC警告 -當您嘗試全部答复時顯示消息 如果您的郵件地址在“密件抄送”列表中; 缺少附件時提醒,還有更多提醒功能...
- 在郵件對話中回复(全部)帶有所有附件; 回复許多電子郵件 片刻之間; 自動添加問候語 回复時將日期添加到主題中...
- 附件工具:管理所有郵件中的所有附件, 自動分離, 全部壓縮,重命名全部,保存全部...快速報告, 計算選定的郵件...
- 強大的垃圾郵件 習俗 刪除重複的郵件和聯繫人... 使您能夠在Outlook中做得更聰明,更快和更好。



#25372
網站主持人對此評論進行了最小化
0
0

#25373
網站主持人對此評論進行了最小化
0
0

#27444
網站主持人對此評論進行了最小化
0
0

#27445
網站主持人對此評論進行了最小化
即時報告
0
0

#28035
網站主持人對此評論進行了最小化
0
0

#28806
網站主持人對此評論進行了最小化
0
0

#28807
網站主持人對此評論進行了最小化
即時報告
0
0

#28808
網站主持人對此評論進行了最小化
0
0

#28809
網站主持人對此評論進行了最小化
即時報告
0
0

#28810
網站主持人對此評論進行了最小化
0
0

#29727
網站主持人對此評論進行了最小化
即時報告
0
0

#29756
網站主持人對此評論進行了最小化
0
0

#33356
網站主持人對此評論進行了最小化
即時報告
0
0

#34871
網站主持人對此評論進行了最小化
0
0

#34872
網站主持人對此評論進行了最小化
即時報告
0
0
這裡還沒有評論