Hi Gerit,
I think, you can add a UserForm to your project. It follows a sample for
a timer function. Show the UserForm non-modal and start the timer. In
the Sub Timer stop the timer again and unload the UserForm.
You can start the timer from within ThisOutlookSession with:
EnableTimer 1000, me
and don´t forget to stop it!
<ThisOutlookSession>
public sub Timer()
' do s.th.
end sub
</ThisOutlookSession>
<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>