G
Guest
I need to create a mass mailing and would like the message to come from my
manager. Is this possible?
manager. Is this possible?
While now the post is even older, I would like to thank susieQ522 for her post. That worked for me! But, I wasn't looking forward to going into 500 emails and changing each email one-by-one, so I created the code below to automatically change them while they are in your Outbox, before you go back to working online.
A couple of notes:
* The code will only work if you have something selected and you need to be in the Outbox (as a safeguard).
* Make sure you have rights to whomever you are trying to send it from and that you spell it correctly. As a test I used my Hotmail account as the from address using Outlook at work where we have an Exchange server and it ending up sending them from my default work Outlook address instead.
* I suggest you run a few test emails before selected all of yours to begin with.
* I tried using objItem.Sender first but it kept erroring out on me so I tried objItem.SentOnBehalfOfName instead and it worked perfect for me.
* You need to have the Developer tab showing in Outlook. I clicked the Visual Basic button on that tab and added the code below. After that, select the emails in your Outbox and then click the Macros dropdown button on the Developer tab and select the FromAnotherUser macro.
Sub FromAnotherUser()
On Error GoTo ErrorHandler
Dim objItem As Outlook.MailItem
Dim intSelected As Integer ' Number of emails selected.
Dim strSentOnBehalfOf As String ' Who we want the email to be from.
Dim intResponse As Integer ' Used to confirm with the user they want to make the change.
intSelected = Application.ActiveExplorer.Selection.Count
strSentOnBehalfOf = "(e-mail address removed)" ' Change this to fit your needs. Make sure you have rights to this account and it is spelled correctly!
' Require that this procedure be called only when a message is selected.
If intSelected = 0 Then
Exit SubEnd If
' Only run this procedure if we are in the Outbox.
If Application.ActiveExplorer.CurrentFolder = "Outbox" Then
' Confirm that user wants to proceed.intResponse = MsgBox("Are you sure you want to mark these " & intSelected & " messages as being from " & strSentOnBehalfOf & "?", vbYesNoCancel, "Change Sender?")If intResponse = vbYes ThenFor Each objItem In Application.ActiveExplorer.SelectionIf objItem.Class = olMail ThenobjItem.SentOnBehalfOfName = strSentOnBehalfOfobjItem.Send ' If working offline it won't send yet, only prepares if for sending (same as opening the email in your Outbox and hitting the Send button).'objItem.Save <- Don't save, otherwise it won't send (email changes from italics to regular font in the Outbox, it needs to be in italics) when back online.End If
Next
Set objItem = Nothing
End IfEnd If
Exit Sub 'To Avoid ErrorHandler.
ErrorHandler:
MsgBox "Error #" & Err.Number & " - " & Err.Description, vbOKOnly, "Error"
End Sub