More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 20-Oct-2014 03:07

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

Login Password
Remember me
Register | Send my password
    Page [ 1 ]  
 Basic Outlook Printer Friendly Version
Working with Outlook items, folders, recipients; dealing with security; writing event handlers
Topic
copy data from Excel into email body
I hope someone can help. What I'm task with is fairly straight forward but I'm afraid is way over my coding skills.

Here's what I'm trying to do. I have the following macro that creates a new message and inserts an excel attachment. However there is data in the attachment that I would like to paste in the actual email body. There is only one worksheet with data in the spreadsheet. Here is the code I have so far:

Sub cmdSendmsg_Click()
    
    Dim objOutlook
    Dim objMail
    Dim strMsg

    'Create a new message
        Set objOutlook = CreateObject("Outlook.Application")
        Set objMail = objOutlook.CreateItem(olMailItem)
        objMail.SentOnBehalfOfName = "email from address"
        objMail.To = "email to address"
        objMail.Attachments.Add "C:\Test\Test.xlsx"
        objMail.CC = "email cc address"
        objMail.Subject = "this subject"
        objMail.Save

    Set objMail = Nothing
    Set objOutlook = Nothing

End Sub

so in that attachment I am adding, can I open it, copy the data, paste in body then close it?

  13-Nov-2012  21:24
  09-Dec-2012  21:13   
Learned so much from this one.
    Page [ 1 ]