DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Excel/Outlook Macro

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Excel/Outlook Macro

    [Originally posted by JwL]

    I'm definitely not a programmer, but am trying to dabble in VBA to make my life a little easier. I've got an excel column full of client email addresses & I'm trying to create a macro that will 1) generate an email in Outlook, 2) add Subject Text, 3) add Body Text, 4) Send the email, and 5) repeat until there are no more email addresses in the excel column. I've been able to create a macro that will open the emails in Outlook and add the Subject text for each, but I can't get the Body text and Send actions to work. Anyone have advice??? Thanks very much. John

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Excel/Outlook Macro

    [Originally posted by K.Ikaunieks]

    try code something like this:-

    Dim olApp As Outlook.Application

    Set olApp = New Outlook.Application

    Dim newMail As Outlook.MailItem

    Set newMail = olApp.CreateItem(olMailItem)
    With newMail
    .Recipients.Add (" the email address from your Excel list")
    .Subject = "Demo"
    .Body = "This is the body of Email"

    .Send
    End With

    Set newMail = Nothing
    Set olApp = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center