Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending mail from Excel 1

Status
Not open for further replies.

Rebellion34

Technical User
May 7, 2008
30
US
Hi,

Can anyone assist me with an issue I am having am trying to automate an email of a spreadsheet from Excel. I have the code pretty much figured out and can get the email to generate as predicted, but then I get the pop up window asking if I wish to send the mail. Is there a way to turn this feature of for a specific Macro command if so can you explain how this is done. Also I need to set a parameter that only sends the email on specific days i.e. not weekends is there a code for this? here is what I have so far.

Sub Email()

Application.OnTime TimeValue("16:00:00"), "Email"
ActiveWorkbook.SendMail "user@email.com", "Monthly receiving log"

End Sub

thanks in advance for any help

Rob
 
Using .SendMail you can't bypass the Outlook security message I'm afraid. You can bypass it using other methods of sending the mail (e.g. CDO).

As for not sending on specific days, you can just check the WeekDay() of the current date (something like):
Code:
If Not Weekday(Date) = 7 And Not Weekday(Date) = 1 Then
    ActiveWorkbook.SendMail "user@email.com", "Monthly receiving log"
End If
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
HarleyQuinn,

Many thanks for the code and the advice I really appreciate it and aspire to at least know a little of what you guys do in writing code.

Thanks again

Rob
 
Glad I could help Rob, thanks for the star [smile]

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top