E Mail from Excel using a command botton

B

Bob C

I am trying to program a command button to send a workbook to a preset e mail
address. Why will this code not work? The CommandButton line fails. I do not
know much about VB.

Private Sub CommandButton1_Click()
Sub Mail_workbook_1()
ActiveWorkbook.SendMail "(e-mail address removed)", _
"This is the Subject line"
End Sub

Thanks for your help.
Bob
 
R

Ron de Bruin

Hi Bob

You must only copy the code lines in the Click event
Like this :

Private Sub CommandButton1_Click()
ActiveWorkbook.SendMail "(e-mail address removed)", _
"This is the Subject line"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top