thanks for your quick help.
I chaged some code, and it works fine.
now I have another problem which is getting Item object in the
BeforeReminderShow.
When I use Application_Reminder, I can get the Appointment item object, so I
changed label and use Item.end time.
But in case of BeforeReminderShow, how can I get the item object.
here is my code.
I made class modules for solve previous problems.
'''''''''''''''''''''''''''ThisOutlookSession'''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim ReminderClass As New Class1
Private Sub Application_Startup()
ReminderClass.init
End Sub
Private Sub Application_Quit()
DisableTimer
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''Class1''''''''''''''''''''''''''''''''''''''''''
Private WithEvents myolapp As Outlook.Application
Private WithEvents colReminders As Reminders
Sub Class_Terminate()
Call DeRefExplorers
End Sub
Public Sub init()
Set myolapp = Outlook.Application
Set colReminders = myolapp.Reminders
End Sub
Public Sub DeRefExplorers()
Set myolapp = Nothing
Set colReminders = Nothing
End Sub
Private Sub colReminders_BeforeReminderShow(Cancel As Boolean)
Dim lngAns As Long
lngAns = MsgBox("Do you want to view the reminder?", vbYesNo)
If lngAns = vbYes Then
Cancel = False
Else
Cancel = True
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''module1''''''''''''''''''''''''''''''''''''''''''
' <Modul: modTimer.bas>
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
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''