Rishek
06-20-2017, 03:22 PM
Fully aware that I am trying to do something a bit idiotic, but here's what I'm trying to achieve: I want a button that automatically sends the current item to preset addresses and then resends it twice to further addresses. Here's what I've got:
Sub MAILBLAST()
Call Resend
Call Resend2
Call Resend3
End Sub
Sub Resend()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = "myemail@email.com"
rMsg.To = "Address that can't be Bcc'd (Printer)"
rMsg.BCC = "Distribution 1"
rMsg.Send
End If
End Sub
Sub Resend2()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = ""myemail@email.com"
rMsg.BCC = "Distribution 2"
rMsg.Send
End If
End Sub
Sub Resend3()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = "myemail@email.com"
rMsg.BCC = "Distribution 3"
rMsg.Send
End If
End Sub
The obvious difficulty is that once the first Resend() runs, the message is sent and I lose the .CurrentItem. How can I circumvent this?
Many thanks to Stefano Balzarotti for the original code.
Sub MAILBLAST()
Call Resend
Call Resend2
Call Resend3
End Sub
Sub Resend()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = "myemail@email.com"
rMsg.To = "Address that can't be Bcc'd (Printer)"
rMsg.BCC = "Distribution 1"
rMsg.Send
End If
End Sub
Sub Resend2()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = ""myemail@email.com"
rMsg.BCC = "Distribution 2"
rMsg.Send
End If
End Sub
Sub Resend3()
Dim rMsg As MailItem, oInspector As Inspector
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
MsgBox "No active inspector"
Else
Set rMsg = oInspector.CurrentItem
rMsg.To = "myemail@email.com"
rMsg.BCC = "Distribution 3"
rMsg.Send
End If
End Sub
The obvious difficulty is that once the first Resend() runs, the message is sent and I lose the .CurrentItem. How can I circumvent this?
Many thanks to Stefano Balzarotti for the original code.