![]() |
Enter email in 'From box' when sending mail via excel
Hi,
i'm trying to write a macro to send an email. De code to do this can be found throughout the web. However it is not specified how to enter an adress in the 'From' field. In my email i have the rights to multiple email account and inboxes. Ik would like to send an email from one specific email adress. Is this possible??? The code i've tried is shown below. __________________________________________________ _________ Sub Mail_Uit(Van As String, Naar As String, Carbon As String, Onderwerp As String) 'Application.DisplayAlerts = False 'Application.ScreenUpdating = False 'Variable declaration Dim oApp As Object Dim oMail As Object ' Create and show the outlook mail item Set oApp = CreateObject("Outlook.Application") Set oMail = oApp.CreateItem(0) With oMail .From = Van ' THIS LINE DOES NOT WORK .To = Naar .CC = Carbon .Subject = "Test email van correspondentieregister" '.Attachments.Add .Display End With ' Restore screen updating and release Outlook 'Application.ScreenUpdating = True Set oMail = Nothing Set oApp = Nothing 'Application.DisplayAlerts = True End Sub ________________________________ |
Enter email in 'From box' when sending mail via excel
Hoi Sjaak
In all versions you can use this If you want to change the sender name and reply address add this code line 'The receiver can see the original mail address in the properties if he want .SentOnBehalfOfName = """SenderName"" " In 2007 it is easy to change a account http://www.rondebruin.nl/mail/account.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Sjaakve" wrote in message ... Hi, i'm trying to write a macro to send an email. De code to do this can be found throughout the web. However it is not specified how to enter an adress in the 'From' field. In my email i have the rights to multiple email account and inboxes. Ik would like to send an email from one specific email adress. Is this possible??? The code i've tried is shown below. __________________________________________________ _________ Sub Mail_Uit(Van As String, Naar As String, Carbon As String, Onderwerp As String) 'Application.DisplayAlerts = False 'Application.ScreenUpdating = False 'Variable declaration Dim oApp As Object Dim oMail As Object ' Create and show the outlook mail item Set oApp = CreateObject("Outlook.Application") Set oMail = oApp.CreateItem(0) With oMail .From = Van ' THIS LINE DOES NOT WORK .To = Naar .CC = Carbon .Subject = "Test email van correspondentieregister" '.Attachments.Add .Display End With ' Restore screen updating and release Outlook 'Application.ScreenUpdating = True Set oMail = Nothing Set oApp = Nothing 'Application.DisplayAlerts = True End Sub ________________________________ |
All times are GMT +1. The time now is 09:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com