Add a module (*.bas) to your project and insert this:
' <modTimer.bas>
Option Explicit
Private Declare Function SetTimer Lib "user32.dll" (ByVal hwnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" (ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Const WM_TIMER = &H113
Private hEvent As Long
Private m_oCallback As Object
Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long _
)
If uMsg = WM_TIMER Then
m_oCallback.Timer
End If
End Sub
Public Function EnableTimer(ByVal msInterval As Long, oCallback As Object)
As Boolean
If hEvent <> 0 Then
Exit Function
End If
hEvent = SetTimer(0&, 0&, msInterval, AddressOf TimerProc)
Set m_oCallback = oCallback
EnableTimer = CBool(hEvent)
End Function
Public Function DisableTimer()
If hEvent = 0 Then
Exit Function
End If
KillTimer 0&, hEvent
hEvent = 0
End Function
' <modTimer.bas>
And this into ThisOutlookSession:
Private Sub Application_Startup()
' Starts the timer with an interval of 60,000 ms (=1 minute)
EnableTimer 60000, Me
End Sub
Public Sub Timer()
' This method will be called by the timer
' So here's the place for your code
End Sub
Private Sub Application_Quit()
' IMPORTANT: The timer must be disabled explicitly if you quit Outlook.
DisableTimer
End Sub
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?productid=300120654&languageid=1
(German:
http://www.VBOffice.net/product.html?pub=6)
Am Tue, 23 Jan 2007 22:16:45 -0500 schrieb George Hester: