Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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

________________________________

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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

________________________________

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending An Email In Excel Programmatically W/O Sending An Object [email protected] Excel Programming 8 December 1st 08 09:35 PM
sending automatic email with VBA-Excel in Vista OS and Windows Mail Ron de Bruin Excel Programming 2 February 21st 08 04:51 PM
Sending mail via excel navin Excel Programming 2 November 11th 06 03:23 PM
General mail failure when sending e-mail from Excel Adrienne Excel Discussion (Misc queries) 5 November 4th 05 12:59 PM


All times are GMT +1. The time now is 04:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"