Hello,
Thank you for this forum, it has been very helpful!
I have a macro that is generating a payment advice from a range in a sheet. This range is included in a separate sheet that and is later used as an attachment of an e-mail in Outlook through macro function below:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
However, in outlook I am using four different e-mails depending of the purpose of my e-mail. One personal and three work e-mails. I have seen that if I change the default e-mail on "Start\Settings\Control Panel\Mail\E-mail accounts\Data files" to correct work e-mail (from which I want to send the payment advices) then the e-mail generated from my macro will be sent from this e-mail stored in "Data files".
However this gives me a problem because I have my "To do list" stored in my personal e-mail and not in my work e-mail and when I change the default e-mail in "Data files" it doesn't only change e-mail used in macro but also the "To do list". And my entries are lost until I change back to my personal e-mail in control panel.
Therefore I tried below code:
With OutMail
.to = "hello[at]hello.com"
.from = "myworkemail[at]myworkemail.com" <-----
.Subject = "Hello"
.Attachments.Add ...
.Display
End With
But the .from line didn't work as I expected.
Is there a way to override the default settings in control panel in order to control the e-mail from which message is sent through macro?
Thanks in advance!
Jonathan
Thank you for this forum, it has been very helpful!
I have a macro that is generating a payment advice from a range in a sheet. This range is included in a separate sheet that and is later used as an attachment of an e-mail in Outlook through macro function below:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
However, in outlook I am using four different e-mails depending of the purpose of my e-mail. One personal and three work e-mails. I have seen that if I change the default e-mail on "Start\Settings\Control Panel\Mail\E-mail accounts\Data files" to correct work e-mail (from which I want to send the payment advices) then the e-mail generated from my macro will be sent from this e-mail stored in "Data files".
However this gives me a problem because I have my "To do list" stored in my personal e-mail and not in my work e-mail and when I change the default e-mail in "Data files" it doesn't only change e-mail used in macro but also the "To do list". And my entries are lost until I change back to my personal e-mail in control panel.
Therefore I tried below code:
With OutMail
.to = "hello[at]hello.com"
.from = "myworkemail[at]myworkemail.com" <-----
.Subject = "Hello"
.Attachments.Add ...
.Display
End With
But the .from line didn't work as I expected.
Is there a way to override the default settings in control panel in order to control the e-mail from which message is sent through macro?
Thanks in advance!
Jonathan