Thread: VBA coding
View Single Post
  #2  
Old May 21st 10, 08: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

Ads