Macro creates email, but wont send out

fatsnack

New Member
Joined
Jul 9, 2011
Messages
19
Good morning , <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I have a macro that will attach the workbook, include email address, subject line and body into an email through outlook. I would like for the email to send out on creation. I’ve read this might be a security thing for outlook and one option is to install “clickYes” to auto click send. Is there any way I can include some more code to send out on creation or if there is an option I am overlooking in outlook? I am using outlook 2010 and excel 2010. <o:p></o:p>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Thank you for your speedy response. I don’t have a third party trying to access my email issue. My macro creates a New email on my machine and it waits for me to hit the send button. I am trying to auto run a report every 24 hours and email out without human interaction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
 
Upvote 0
You'll need to post your code. You probably have .Display instead of .Send
 
Upvote 0
try this:

Private Sub Label5_Click()
Dim App, Mail As Object
Application.ScreenUpdating = False
'Sending email through outlook
Set App = CreateObject("Outlook.Application")
Set Mail = App.CreateItem(0)
With Mail
.To = "email1@yahoo.com"
.cc = "email2@yahoo.com"
.Subject = "My workbook"
.body = "Content of email"
.display ' if you wanna to see the email
.ReadReceiptRequested = False
.Attachments.Add ActiveWorkbook.FullName
'.send = True 'automatically send the email
End With
Set App = Nothing
Set Mail = Nothing
Application.ScreenUpdating = true
End Sub
 
Upvote 0
THank you! I did have display and not send . Now it brings me up to the "a program is trying to send an e-mail message on your behalf" screen. Is there a safe way to enable that email to send through my account without turning off the security setting?
 
Upvote 0
When I used to send automated e-mails in Excel 2003 I had to use ClickYes to get around the prompt, but since I've moved to 2007 I haven't. Not sure what was changed as we migrated Office and Exchange to newer versions at the same time.

If it's your own PC, and it has a current virus and malware scanner, I don't see a security issue using ClickYes. I personally wouldn't allow non-tech users to have it installed, though.
 
Upvote 0
THank you! I did have display and not send . Now it brings me up to the "a program is trying to send an e-mail message on your behalf" screen. Is there a safe way to enable that email to send through my account without turning off the security setting?


See the first link that I posted.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top