ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   E Mail from Excel using a command botton (https://www.excelbanter.com/excel-programming/311958-e-mail-excel-using-command-botton.html)

Bob C

E Mail from Excel using a command botton
 
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 ", _
"This is the Subject line"
End Sub

Thanks for your help.
Bob

Ron de Bruin

E Mail from Excel using a command botton
 
Hi Bob

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

Private Sub CommandButton1_Click()
ActiveWorkbook.SendMail ", _
"This is the Subject line"
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Bob C" wrote in message ...
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 ", _
"This is the Subject line"
End Sub

Thanks for your help.
Bob




Anne Troy[_4_]

E Mail from Excel using a command botton
 
Wow. I feel like a buffoon. LOL!! Nice catch, Ron.

"Ron de Bruin" wrote in message
...
Hi Bob

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

Private Sub CommandButton1_Click()
ActiveWorkbook.SendMail ", _
"This is the Subject line"
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Bob C" wrote in message

...
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 ", _
"This is the Subject line"
End Sub

Thanks for your help.
Bob






Bob C

E Mail from Excel using a command botton
 
Thanks so much! Bob C
Ignore the next post sent by accident.

"Ron de Bruin" wrote:

Hi Bob

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

Private Sub CommandButton1_Click()
ActiveWorkbook.SendMail ", _
"This is the Subject line"
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Bob C" wrote in message ...
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 ", _
"This is the Subject line"
End Sub

Thanks for your help.
Bob






All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com