Modify my code to copy ranges to email

  • Hi Guys,


    I have the code below to email the results of whatever data is on A3 and B3 if I typed "Y" in M3. It will open up an email body using the Subject line on M2 and using the email address on M1


    I'm planning to add a chart which I will place somewhere in A20 as part of the email. I realized it will be easier for me if the code will just copy whatever is on column A upto J and rows 1 to 100 including charts, pictures etc...


    Is this doable? Thanks in advance!


  • Re: Modify my code to copy ranges to email


    this codes copy charts into email body, hope you will be able to ammend it into yours for your better learning.


    Code
    Sub CopyAndPasteToMailBody()
        Set mailApp = CreateObject("Outlook.Application")
        Set mail = mailApp.CreateItem(olMailItem)
        mail.Display
        Set wEditor = mailApp.ActiveInspector.wordEditor
        ActiveChart.ChartArea.Copy
        wEditor.Application.Selection.Paste
    End Sub
  • Re: Modify my code to copy ranges to email


    Quote from ashu1990;745975

    this codes copy charts into email body, hope you will be able to ammend it into yours for your better learning.


    Code
    Sub CopyAndPasteToMailBody()
        Set mailApp = CreateObject("Outlook.Application")
        Set mail = mailApp.CreateItem(olMailItem)
        mail.Display
        Set wEditor = mailApp.ActiveInspector.wordEditor
        ActiveChart.ChartArea.Copy
        wEditor.Application.Selection.Paste
    End Sub



    thanks ashu... I have actually tried that but unfortunately if I insert it to my existing code, it opens up 2 new emails.. 1 for my original code and 1 for the chart :( i'm really not good in VBA and i'm hoping someone can help me out..

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!