PC Review


Reply
Thread Tools Rate Thread

Sending email at certain Time

 
 
Fester
Guest
Posts: n/a
 
      4th May 2005
Is it possible to have Excel automatically send an email at a specified
time during the day. I have sales numbers that I want emailed to me at
say 12 and 3 pm.

Fester

 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      5th May 2005
Fester,

The code below will send an email to (E-Mail Removed)

It will send the sales numbers from cells A1, A2, and A3, from sheet "Sales
Data"

To make it work, you must set a reference to Outlook from the VBE, and Excel
must always be running.

HTH,
Bernie
MS Excel MVP


Dim NextTime As Date

Sub StartIt()
If Time() < 0.5 Then
NextTime = Int(Now()) + 0.5
ElseIf Time() > 0.625 Then
NextTime = Int(Now()) + 1.5
Else
NextTime = Int(Now()) + 0.625
End If
Application.OnTime NextTime, "Update"
End Sub

Sub Update()
MailIt
If Time() > 0.625 Then
NextTime = Int(Now()) + 1.5
Else
NextTime = Int(Now()) + 0.625
End If
Application.OnTime NextTime, "Update"
End Sub

Sub StopIt()
Application.OnTime NextTime, "Update", schedule:=False
End Sub

Sub MailIt()
Dim ol As Object, myItem As Object
Set ol = CreateObject("outlook.application")
Set myItem = ol.CreateItem(olMailItem)
myItem.To = "(E-Mail Removed)"
myItem.Subject = "Sales Number..."
myItem.Body = "Hello Kevin, " & Chr(13) & Chr(13)
myItem.Body = myItem.Body & "Sales data from Cell A1: " & _
Worksheets("Sales Data").Range("A1").Value & Chr(13)
myItem.Body = myItem.Body & "Sales data from Cell A2: " & _
Worksheets("Sales Data").Range("A2").Value & Chr(13)
myItem.Body = myItem.Body & "Sales data from Cell A3: " & _
Worksheets("Sales Data").Range("A3").Value & Chr(13) & Chr(13)
myItem.Body = myItem.Body & "Fester" & Chr(13) & Format(Now, "mm/dd/yy
hh:mm:ss")
myItem.Send
Set ol = Nothing
Set myItem = Nothing
End Sub

"Fester" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is it possible to have Excel automatically send an email at a specified
> time during the day. I have sales numbers that I want emailed to me at
> say 12 and 3 pm.
>
> Fester
>



 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      5th May 2005
Aaarg - forgot that the code was written for and works with Outlook 2000 -
the security settings of later versions won't allow unattended emailing.

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org> wrote in message
news:(E-Mail Removed)...
> Fester,
>
> The code below will send an email to (E-Mail Removed)
>
> It will send the sales numbers from cells A1, A2, and A3, from sheet

"Sales
> Data"
>
> To make it work, you must set a reference to Outlook from the VBE, and

Excel
> must always be running.
>
> HTH,
> Bernie
> MS Excel MVP
>
>
> Dim NextTime As Date
>
> Sub StartIt()
> If Time() < 0.5 Then
> NextTime = Int(Now()) + 0.5
> ElseIf Time() > 0.625 Then
> NextTime = Int(Now()) + 1.5
> Else
> NextTime = Int(Now()) + 0.625
> End If
> Application.OnTime NextTime, "Update"
> End Sub
>
> Sub Update()
> MailIt
> If Time() > 0.625 Then
> NextTime = Int(Now()) + 1.5
> Else
> NextTime = Int(Now()) + 0.625
> End If
> Application.OnTime NextTime, "Update"
> End Sub
>
> Sub StopIt()
> Application.OnTime NextTime, "Update", schedule:=False
> End Sub
>
> Sub MailIt()
> Dim ol As Object, myItem As Object
> Set ol = CreateObject("outlook.application")
> Set myItem = ol.CreateItem(olMailItem)
> myItem.To = "(E-Mail Removed)"
> myItem.Subject = "Sales Number..."
> myItem.Body = "Hello Kevin, " & Chr(13) & Chr(13)
> myItem.Body = myItem.Body & "Sales data from Cell A1: " & _
> Worksheets("Sales Data").Range("A1").Value & Chr(13)
> myItem.Body = myItem.Body & "Sales data from Cell A2: " & _
> Worksheets("Sales Data").Range("A2").Value & Chr(13)
> myItem.Body = myItem.Body & "Sales data from Cell A3: " & _
> Worksheets("Sales Data").Range("A3").Value & Chr(13) & Chr(13)
> myItem.Body = myItem.Body & "Fester" & Chr(13) & Format(Now, "mm/dd/yy
> hh:mm:ss")
> myItem.Send
> Set ol = Nothing
> Set myItem = Nothing
> End Sub
>
> "Fester" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Is it possible to have Excel automatically send an email at a specified
> > time during the day. I have sales numbers that I want emailed to me at
> > say 12 and 3 pm.
> >
> > Fester
> >

>
>



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      5th May 2005
> the security settings of later versions won't allow unattended emailing.

See this page
http://www.rondebruin.nl/cdo.htm

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



"Bernie Deitrick" <deitbe @ consumer dot org> wrote in message news:%(E-Mail Removed)...
> Aaarg - forgot that the code was written for and works with Outlook 2000 -
> the security settings of later versions won't allow unattended emailing.
>
> HTH,
> Bernie
> MS Excel MVP
>
>
> "Bernie Deitrick" <deitbe @ consumer dot org> wrote in message
> news:(E-Mail Removed)...
>> Fester,
>>
>> The code below will send an email to (E-Mail Removed)
>>
>> It will send the sales numbers from cells A1, A2, and A3, from sheet

> "Sales
>> Data"
>>
>> To make it work, you must set a reference to Outlook from the VBE, and

> Excel
>> must always be running.
>>
>> HTH,
>> Bernie
>> MS Excel MVP
>>
>>
>> Dim NextTime As Date
>>
>> Sub StartIt()
>> If Time() < 0.5 Then
>> NextTime = Int(Now()) + 0.5
>> ElseIf Time() > 0.625 Then
>> NextTime = Int(Now()) + 1.5
>> Else
>> NextTime = Int(Now()) + 0.625
>> End If
>> Application.OnTime NextTime, "Update"
>> End Sub
>>
>> Sub Update()
>> MailIt
>> If Time() > 0.625 Then
>> NextTime = Int(Now()) + 1.5
>> Else
>> NextTime = Int(Now()) + 0.625
>> End If
>> Application.OnTime NextTime, "Update"
>> End Sub
>>
>> Sub StopIt()
>> Application.OnTime NextTime, "Update", schedule:=False
>> End Sub
>>
>> Sub MailIt()
>> Dim ol As Object, myItem As Object
>> Set ol = CreateObject("outlook.application")
>> Set myItem = ol.CreateItem(olMailItem)
>> myItem.To = "(E-Mail Removed)"
>> myItem.Subject = "Sales Number..."
>> myItem.Body = "Hello Kevin, " & Chr(13) & Chr(13)
>> myItem.Body = myItem.Body & "Sales data from Cell A1: " & _
>> Worksheets("Sales Data").Range("A1").Value & Chr(13)
>> myItem.Body = myItem.Body & "Sales data from Cell A2: " & _
>> Worksheets("Sales Data").Range("A2").Value & Chr(13)
>> myItem.Body = myItem.Body & "Sales data from Cell A3: " & _
>> Worksheets("Sales Data").Range("A3").Value & Chr(13) & Chr(13)
>> myItem.Body = myItem.Body & "Fester" & Chr(13) & Format(Now, "mm/dd/yy
>> hh:mm:ss")
>> myItem.Send
>> Set ol = Nothing
>> Set myItem = Nothing
>> End Sub
>>
>> "Fester" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Is it possible to have Excel automatically send an email at a specified
>> > time during the day. I have sales numbers that I want emailed to me at
>> > say 12 and 3 pm.
>> >
>> > Fester
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS HELP pop up every time sending email; stop it how? JoeDontKnow Windows XP Basics 10 26th Oct 2009 06:38 PM
MS HELP pop up every time sending email; stop it how? JoeDontKnow Windows XP Customization 10 26th Oct 2009 06:38 PM
MS HELP pop up every time sending email; stop it how? JoeDontKnow Windows XP General 10 26th Oct 2009 06:38 PM
Outlook, sending time delayed email with current delivery time =?Utf-8?B?Qm9iZGVhZg==?= Microsoft Outlook Discussion 0 25th Apr 2006 03:56 PM
Sending email at a specific time? =?Utf-8?B?TS5ELg==?= Microsoft Outlook Discussion 0 21st Apr 2005 10:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:39 AM.