Using the CreateItem Method to Create Default Items : Email « Outlook « VBA / Excel / Access / Word






Using the CreateItem Method to Create Default Items

 
Sub mail()
    Dim myMessage As MailItem
    Set myMessage = Application.CreateItem(ItemType:=olMailItem)
    With myMessage
        .To = "test@example.com"
        .Subject = "Test message"
        .Body = "This is a test message."
        .Display
    End With
End Sub

 








Related examples in the same category

1.Send email for all records in an Access table
2.Send email by Using POP3
3.Display the information in a list of mails
4.Searching for Items
5.Adds an addressee, a subject, and body text; applies the HTML format; sets the importance to high; and sends the message:
6.Sending a Message
7.Send a table through email
8.Send out an email by using the DoCmd.SendObject