Take your career to the next level with convenient certification training. Start your 7-day Free Trial
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerfunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public lngTimerID As Long
Public Sub ActivateTimer(ByVal lngMinutes As Long)
'The SetTimer call accepts milliseconds, so convert to minutes'
lngMinutes = lngMinutes * 1000 * 60
'Check to see if timer is running before call to SetTimer
If lngTimerID <> 0 Then Call DeactivateTimer
lngTimerID = SetTimer(0, 0, lngMinutes, AddressOf TriggerTimer)
If lngTimerID = 0 Then
MsgBox "The timer failed to activate."
Public Sub DeactivateTimer()
Dim lSuccess As Long
lSuccess = KillTimer(0, lngTimerID)
If lSuccess = 0 Then
MsgBox "The timer failed to deactivate."
lngTimerID = 0
Private Sub TriggerTimer(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idevent As Long, ByVal Systime As Long)
'Change the name of the macro to run on the next line'
Open in new window
Dim olRules As Outlook.Rules
Dim myRule As Outlook.Rule
Dim olRuleName As String
olRuleName = "MyRule"
Set olRules = Application.Session.DefaultStore.GetRules()
For Each myRule In olRules
If myRule.name = name Then
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.