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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

fatsnack

New Member
Joined
Jul 9, 2011
Messages
19
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>
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
You'll need to post your code. You probably have .Display instead of .Send
 

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
969

ADVERTISEMENT

Agreed with VoG. Sounds like one change is needed.
 

DannyBOHLEN

New Member
Joined
Feb 8, 2012
Messages
16
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
 

fatsnack

New Member
Joined
Jul 9, 2011
Messages
19

ADVERTISEMENT

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?
 

mvptomlinson

Well-known Member
Joined
Mar 10, 2008
Messages
2,638
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.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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.
 

Forum statistics

Threads
1,144,693
Messages
5,725,796
Members
422,640
Latest member
KazPL

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
Top