A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VBA coding



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 20th 10, 02:03 PM posted to microsoft.public.outlook.program_vba
mwang
external usenet poster
 
Posts: 2
Default VBA coding

I need to mail a reminder twice a day at intervals.this i have done as long
as my excel is open and the code which i had put in the code module,

Public RunWhen As Double
Public Const cRunIntervalhour = 5
Public Const cRunWhat = "mycode" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(cRunIntervalhour, 0, 0)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub


Sub mycode()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = "..................." ' the ids to which i need to mail the
reminder
.CC = ""
.BCC = ""
.Subject = "Timesheet_remainder"
.HTMLBody = "Hi All" & "" & "Please finalize the TRS both in iPTS
and People Soft for this week" & " " & "Thank You"
.Send
End With
StartTimer
End Sub

this I have to run everyday each time opening my excel. I need suggestions
to make my macro run automatically when the excel is still closed.

also plz suggest me how to do this from my outlook

Ads
  #2  
Old May 21st 10, 09:47 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default VBA coding


Here's an example for how to do it in Outlook:
http://www.vboffice.net/sample.html?...0&cmd=showitem

The code won't execute if Outlook isn't running.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en


Am Thu, 20 May 2010 05:03:01 -0700 schrieb mwang:

I need to mail a reminder twice a day at intervals.this i have done as

long
as my excel is open and the code which i had put in the code module,

Public RunWhen As Double
Public Const cRunIntervalhour = 5
Public Const cRunWhat = "mycode" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(cRunIntervalhour, 0, 0)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub


Sub mycode()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = "..................." ' the ids to which i need to mail the
reminder
.CC = ""
.BCC = ""
.Subject = "Timesheet_remainder"
.HTMLBody = "Hi All" & "" & "Please finalize the TRS both in iPTS
and People Soft for this week" & " " & "Thank You"
.Send
End With
StartTimer
End Sub

this I have to run everyday each time opening my excel. I need suggestions
to make my macro run automatically when the excel is still closed.

also plz suggest me how to do this from my outlook

  #3  
Old May 21st 10, 10:58 AM posted to microsoft.public.outlook.program_vba
mwang
external usenet poster
 
Posts: 2
Default VBA coding

thanks 4 ur reply
but i dont want a macro trigger such as a reminder or any other event
handlers. but keeping my excel or keeping my outlook still how do i trigger
macro to be run weekly by itself

"Michael Bauer [MVP - Outlook]" wrote:


Here's an example for how to do it in Outlook:
http://www.vboffice.net/sample.html?...0&cmd=showitem

The code won't execute if Outlook isn't running.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en


Am Thu, 20 May 2010 05:03:01 -0700 schrieb mwang:

I need to mail a reminder twice a day at intervals.this i have done as

long
as my excel is open and the code which i had put in the code module,

Public RunWhen As Double
Public Const cRunIntervalhour = 5
Public Const cRunWhat = "mycode" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(cRunIntervalhour, 0, 0)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub


Sub mycode()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = "..................." ' the ids to which i need to mail the
reminder
.CC = ""
.BCC = ""
.Subject = "Timesheet_remainder"
.HTMLBody = "Hi All" & "" & "Please finalize the TRS both in iPTS
and People Soft for this week" & " " & "Thank You"
.Send
End With
StartTimer
End Sub

this I have to run everyday each time opening my excel. I need suggestions
to make my macro run automatically when the excel is still closed.

also plz suggest me how to do this from my outlook

.

  #4  
Old May 22nd 10, 06:30 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default VBA coding



What is the difference between a timer event and an event raised by an
appointment item?

If you'd use the appointment, especially with such a long interval of once a
week, Outlook would handle the case for you that you turn off the machine
meantime.

Here's an example for an API timer that you can use in Outlook:
http://www.vboffice.net/sample.html?...4&cmd=showitem

With that you'd have to handle the mentioned case yourself, except you could
ensure the computer never gets turned off. That handler would have to store
anywhere the next date for when it has to raise an event. That compare that
value at your chosen interval with the current time.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Easily share your categories:
SAM - Automatically choose sending account, signature, and sent message
folder:
http://www.vboffice.net/product.html?lang=en


Am Fri, 21 May 2010 01:58:01 -0700 schrieb mwang:

thanks 4 ur reply
but i dont want a macro trigger such as a reminder or any other event
handlers. but keeping my excel or keeping my outlook still how do i

trigger
macro to be run weekly by itself

"Michael Bauer [MVP - Outlook]" wrote:


Here's an example for how to do it in Outlook:
http://www.vboffice.net/sample.html?...0&cmd=showitem

The code won't execute if Outlook isn't running.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en


Am Thu, 20 May 2010 05:03:01 -0700 schrieb mwang:

I need to mail a reminder twice a day at intervals.this i have done as

long
as my excel is open and the code which i had put in the code module,

Public RunWhen As Double
Public Const cRunIntervalhour = 5
Public Const cRunWhat = "mycode" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(cRunIntervalhour, 0, 0)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub


Sub mycode()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = "..................." ' the ids to which i need to mail

the
reminder
.CC = ""
.BCC = ""
.Subject = "Timesheet_remainder"
.HTMLBody = "Hi All" & "" & "Please finalize the TRS both in

iPTS
and People Soft for this week" & " " & "Thank You"
.Send
End With
StartTimer
End Sub

this I have to run everyday each time opening my excel. I need

suggestions
to make my macro run automatically when the excel is still closed.

also plz suggest me how to do this from my outlook

.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color coding sherylg Outlook - Calandaring 3 August 29th 09 03:13 AM
color coding Kimi Mac Outlook - Calandaring 1 February 25th 09 02:43 PM
help coding message options JC Outlook and VBA 1 January 3rd 08 08:47 PM
Color Coding Jeannine Outlook - Calandaring 1 May 23rd 07 03:04 AM
macros without coding? Keleigh-G Outlook and VBA 2 June 28th 06 07:27 PM


All times are GMT +1. The time now is 05:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.