Mail the Activeworkbook using VBA in Microsoft Excel

Sub Mail_workbook()
    ActiveWorkbook.SendMail "ron@debruin.nl", _
                            "This is the Subject line"
End Sub

If you want to mail the workbook where the code is placed you must use the following line:

ThisWorkbook.SendMail "ron@debruin.nl", _

Note: It doesn't have to be the active workbook used at that time.

Comments

  1. "First : comment,

    If i use the line code you write for Mail the Activeworkbook using VBA in Microsoft Excel :

    Sub Mail_workbook()
    ActiveWorkbook.SendMail ""b.mathellier@crittiaa.com""

    End Sub

    VBA accept :

    ActiveWorkbook.SendMail (""b.mathellier@crittiaa.com""),

    but not

    ActiveWorkbook.SendMail ""b.mathellier@crittiaa.com""

    Second : Question for you

    When i write :
    Sub Mail_workbook()
    ActiveWorkbook.SendMail (""b.mathellier@crittiaa.com""), _
    ""This is the Subject line""
    End Sub

    the messge ""erroe 1004"" is return !

    Do you have any solution ?

    I use : Excel 2000, outlook express 6.0

    Thank you for your Help

    Bruno MATHELLIER "

  2. "You can change the mail program in your
    browser.
    Tools>Internetoptions>Programs

    Not all mailprograms can work with SendMail, remember that."

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.