Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Sending Email through a macro

I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Sending Email through a macro

Hi rojobrown

With SendMail the only way to stop the file is to leave the E-mail address empty.
See example 2

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


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

If you use Outlook you have more options (change Send to Display)
See my site for code examples
http://www.rondebruin.nl/sendmail.htm


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



"rojobrown" wrote in message ...
I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 341
Default Sending Email through a macro

you are going to love this site
http://www.rondebruin.nl/sendmail.htm

TOTAL control

--
Allllen


"rojobrown" wrote:

I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Sending Email through a macro

How can I create it in my personal workbook so it doesn't get overwritten
each time I run the file?
--
Thanks a bunch!
rojobrown


"Ron de Bruin" wrote:

Hi rojobrown

With SendMail the only way to stop the file is to leave the E-mail address empty.
See example 2

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


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

If you use Outlook you have more options (change Send to Display)
See my site for code examples
http://www.rondebruin.nl/sendmail.htm


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



"rojobrown" wrote in message ...
I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Sending Email through a macro

Have you try it ?

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



"rojobrown" wrote in message ...
How can I create it in my personal workbook so it doesn't get overwritten
each time I run the file?
--
Thanks a bunch!
rojobrown


"Ron de Bruin" wrote:

Hi rojobrown

With SendMail the only way to stop the file is to leave the E-mail address empty.
See example 2

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


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

If you use Outlook you have more options (change Send to Display)
See my site for code examples
http://www.rondebruin.nl/sendmail.htm


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



"rojobrown" wrote in message ...
I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Sending Email through a macro

Or do you want to know how to put it there

Alt-F11

See personal.xls on the left
Expand it and click on a module
Copy /paste the macro there
Alt-q to go back to excel



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



"Ron de Bruin" wrote in message ...
Have you try it ?

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



"rojobrown" wrote in message ...
How can I create it in my personal workbook so it doesn't get overwritten
each time I run the file?
--
Thanks a bunch!
rojobrown


"Ron de Bruin" wrote:

Hi rojobrown

With SendMail the only way to stop the file is to leave the E-mail address empty.
See example 2

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


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

If you use Outlook you have more options (change Send to Display)
See my site for code examples
http://www.rondebruin.nl/sendmail.htm


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



"rojobrown" wrote in message ...
I'm using the following in vbe for a particular workbook. I would like to be
able to key in a message or a subject before I actually send the file. I
just want to have some control on the file being sent. Can this even be done?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SendMail Recipients:="recipient@address"
End Sub

--
Thanks a bunch!
rojobrown







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending a group email Newbee Excel Worksheet Functions 9 February 11th 10 05:47 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Need a macro to Copy a selection and paste into a new email. Koolmist Excel Discussion (Misc queries) 3 February 20th 06 04:48 PM
How do I email an excel macro? Bruce Excel Discussion (Misc queries) 7 January 20th 06 11:34 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM


All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"