|  

» Mail the Activeworkbook using VBA in Microsoft Excel

VBA macro tip contributed by Ron de Bruin, Microsoft MVP - 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.

Rate This Tip
12 34 5
Rating: 3.78     Views: 38586
Server name
maver  Posted on: 31-12-1969
Where are must be mailserver name near this things? How could Exel know where to send through?
Outlook
Roy  Posted on: 31-12-1969
I believe it will be sent via Outlook - the configuration will be based on the default account
Send Mail
Ron de Bruin  Posted on: 31-12-1969
You can change the mail program in your
browser.
Tools>Internetoptions>Programs

Not all mailprograms can work with SendMail, remember that.
Mulitple Recipients
John  Posted on: 31-12-1969
I'm currently using this with Groupwise, and it works fine, but I can't figure out how to list multiple recipients.
error 1004
MATHELLIER  Posted on: 31-12-1969
Hello,

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



Name
Comment Title
Comments