View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sjaakve Sjaakve is offline
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

________________________________