Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Vlissingen, Netherlands
    Posts
    63
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Create Mail (OL 2003)

    Hi All,

    Created the following code to create an email:
    Private Sub CommandButton1_Click()
    UserForm1.Hide
    Set olApp = Outlook.Application
    'Create e-mail item
    Set objMail = olApp.CreateItem(olMailItem)
    With objMail
    'Set myItem = Application.CreateItem(olMailItem)
    ' .SenderEmailAddress = "sender@domain.com"
    .To = "receiver@domain.com"
    .CC = "copy@domain.com"
    .Subject = "Subject"
    .Body = "Hello," & vbCrLf & vbCrLf & "Thank you for the assistance"
    .Attachments.Add "Cocuments and SettingsusernameMy Documents" & filename & ".xls"
    .Display
    End With
    End Sub

    Like the From field to be added as well however cannot find how to do this, keep getting "property is read only".
    Any suggestions are welcome.

    TIA
    Joop

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Create Mail (OL 2003)

    The From field cannot be set because of security - otherwise you could send mail appearing to be sent by J.P. Balkenende! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    You can set the SentOnBehalfOfName property of objMail. The recipients will be able to see both this name and yours.

  3. #3
    Star Lounger
    Join Date
    Apr 2002
    Location
    Vlissingen, Netherlands
    Posts
    63
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Create Mail (OL 2003)

    Thanks Hans,

    Sounds logical.
    Reagrds,
    Joop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •