Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Not using send button on excel e-mail

I have put some code into my spreadsheet to send an e-mail
including in the message body a value. I would like the e-
mail to be sent automatically, without user intervention
hitting send. Can i do this? The code i have is:

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "
.Subject = "Automated Mail Response"
.Body = "This is an automated message from Excel. " & _
"The cost of the item that you inquired about
is: " & _
Format(Range("A1").Value, "$ #,###.#0") & "."
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Not using send button on excel e-mail

Change Display to Send

But you get a security warning then from Outlook
Maybe CDO is a option for you

See this page
http://www.rondebruin.nl/sendmail.htm#Prevent


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


"Richard" wrote in message ...
I have put some code into my spreadsheet to send an e-mail
including in the message body a value. I would like the e-
mail to be sent automatically, without user intervention
hitting send. Can i do this? The code i have is:

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "
.Subject = "Automated Mail Response"
.Body = "This is an automated message from Excel. " & _
"The cost of the item that you inquired about
is: " & _
Format(Range("A1").Value, "$ #,###.#0") & "."
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Not using send button on excel e-mail

Richard,

just add the following line at the end of this section

With objMail
...
.send
End With

Of course, you may still get the security pop-ups if
you've got the Outlook security patch loaded, but that's
another story. If you do get this problem, there is a way
round it in code: post back if you find you need that.

Cheers, Pete.

-----Original Message-----
I have put some code into my spreadsheet to send an e-

mail
including in the message body a value. I would like the e-
mail to be sent automatically, without user intervention
hitting send. Can i do this? The code i have is:

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "
.Subject = "Automated Mail Response"
.Body = "This is an automated message from Excel. " &

_
"The cost of the item that you inquired about
is: " & _
Format(Range("A1").Value, "$ #,###.#0") & "."
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Not using send button on excel e-mail

Hi Pete

I would be interested in the code for getting round the
security promt

TIA
-----Original Message-----
Richard,

just add the following line at the end of this section

With objMail
...
.send
End With

Of course, you may still get the security pop-ups if
you've got the Outlook security patch loaded, but that's
another story. If you do get this problem, there is a way
round it in code: post back if you find you need that.

Cheers, Pete.

-----Original Message-----
I have put some code into my spreadsheet to send an e-

mail
including in the message body a value. I would like the

e-
mail to be sent automatically, without user intervention
hitting send. Can i do this? The code i have is:

Sub Send_Msg()
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "
.Subject = "Automated Mail Response"
.Body = "This is an automated message from Excel. "

&
_
"The cost of the item that you inquired about
is: " & _
Format(Range("A1").Value, "$ #,###.#0") & "."
.Display
End With
Set objMail = Nothing
Set objOL = Nothing
End Sub
.

.

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
Bypass: A program is trying to send mail using Item.Send prompt Vick Excel Discussion (Misc queries) 1 June 25th 09 03:31 AM
Send e-mail from a Excel file Freshman Excel Worksheet Functions 5 March 24th 08 06:08 PM
Is their any way to set Excel to send an e-mail on date Leger Claude Comeau Excel Discussion (Misc queries) 1 May 14th 07 01:29 AM
how do I add a signature to an e-mail from excel 'send to' tpowers Excel Discussion (Misc queries) 0 July 15th 05 07:39 PM
how to send e-mail from excel Barmaley Excel Programming 3 August 22nd 03 04:26 PM


All times are GMT +1. The time now is 09:55 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"