msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

close reminder window programatically
Goto page 1, 2  Next
 
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Program VBA
Author Message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Mon Feb 04, 2008 2:15 pm    Post subject: close reminder window programatically Reply with quote

Hi All,

I cannot find the way that close reminder window programatically.

I found dismiss method here.
http://msdn2.microsoft.com/en-us/library/bb176766.aspx
But I cannot find close method...

basically, I want these,
1> call sql query at once reminder fire -> done
2> change the label of item -> done
3> close reminder window

Please, advice me!

Thanks,
soworl

Archived from group: microsoft>public>outlook>program_vba
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Mon Feb 04, 2008 6:16 pm    Post subject: Re: close reminder window programatically Reply with quote

There's no method of closing the window when it's opened. You can intercept
the event when a reminder fires and prevent the window from opening in the
first place. Once it's opened you would have to use FindWindow() or some
other Win32 API calls to get the window handle for the Reminders window and
then send it a WM_CLOSE message, again using Win32 API calls.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> Hi All,
>
> I cannot find the way that close reminder window programatically.
>
> I found dismiss method here.
> http://msdn2.microsoft.com/en-us/library/bb176766.aspx
> But I cannot find close method...
>
> basically, I want these,
> 1> call sql query at once reminder fire -> done
> 2> change the label of item -> done
> 3> close reminder window
>
> Please, advice me!
>
> Thanks,
> soworl
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Mon Feb 04, 2008 3:42 pm    Post subject: Re: close reminder window programatically Reply with quote

Thanks Ken,

Can you give me a useful link for intercept the event & prevent open
reminder window?

for your info, Here is my code
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim WithEvents myolapp As Outlook.Application

Private Sub Application_Startup()
Initialize_handler
End Sub

Sub Initialize_handler()
Set myolapp = Outlook.Application
End Sub

Private Sub myolapp_Reminder(ByVal Item As Object)
Interval = DateDiff("s", Now(), Item.End) 'seconds
EnableTimer Interval * 1000, Me 'first parameter=milliseconds
' I'll add sql query here
SetApptColorLabel Item, 5
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Thanks,
soworl
"Ken Slovak - [MVP - Outlook]" wrote:

> There's no method of closing the window when it's opened. You can intercept
> the event when a reminder fires and prevent the window from opening in the
> first place. Once it's opened you would have to use FindWindow() or some
> other Win32 API calls to get the window handle for the Reminders window and
> then send it a WM_CLOSE message, again using Win32 API calls.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > Hi All,
> >
> > I cannot find the way that close reminder window programatically.
> >
> > I found dismiss method here.
> > http://msdn2.microsoft.com/en-us/library/bb176766.aspx
> > But I cannot find close method...
> >
> > basically, I want these,
> > 1> call sql query at once reminder fire -> done
> > 2> change the label of item -> done
> > 3> close reminder window
> >
> > Please, advice me!
> >
> > Thanks,
> > soworl
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Mon Feb 04, 2008 6:50 pm    Post subject: Re: close reminder window programatically Reply with quote

The Application.Reminder() event can't be cancelled, so it's good for
telling you that a reminder has fired only, not for preventing the Reminders
window from appearing. For that you want to use the Application.Reminders
collection and to handle the BeforeReminderShow(Cancel As Boolean) event. If
Cancel is set to True in that event the window won't open. Then you can
handle the Reminders.ReminderFire() event to see what reminder is firing or
use the Application.Reminder event to see that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> Thanks Ken,
>
> Can you give me a useful link for intercept the event & prevent open
> reminder window?
>
> for your info, Here is my code
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Dim WithEvents myolapp As Outlook.Application
>
> Private Sub Application_Startup()
> Initialize_handler
> End Sub
>
> Sub Initialize_handler()
> Set myolapp = Outlook.Application
> End Sub
>
> Private Sub myolapp_Reminder(ByVal Item As Object)
> Interval = DateDiff("s", Now(), Item.End) 'seconds
> EnableTimer Interval * 1000, Me 'first
> parameter=milliseconds
> ' I'll add sql query here
> SetApptColorLabel Item, 5
> End Sub
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
> Thanks,
> soworl
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Mon Feb 04, 2008 5:04 pm    Post subject: Re: close reminder window programatically Reply with quote

thanks for your help.

I modified my source for test, but it's not working.
I cannot see the msg box, "Do you want to view the reminder"

do you know what's wrong?

Thanks,
soworl
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim WithEvents myolapp As Outlook.Application
Dim WithEvents colReminders As Reminders

Private Sub Application_Startup()
Initialize_handler
End Sub

Sub Initialize_handler()
Set myolapp = Outlook.Application
Set colReminders = myolapp.Reminders
End Sub

Private Sub myolapp_Reminder(ByVal Item As Object)
Interval = DateDiff("s", Now(), Item.End) 'seconds
EnableTimer Interval * 1000, Me 'first parameter=milliseconds
SetApptColorLabel Item, 5
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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

"Ken Slovak - [MVP - Outlook]" wrote:

> The Application.Reminder() event can't be cancelled, so it's good for
> telling you that a reminder has fired only, not for preventing the Reminders
> window from appearing. For that you want to use the Application.Reminders
> collection and to handle the BeforeReminderShow(Cancel As Boolean) event. If
> Cancel is set to True in that event the window won't open. Then you can
> handle the Reminders.ReminderFire() event to see what reminder is firing or
> use the Application.Reminder event to see that.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > Thanks Ken,
> >
> > Can you give me a useful link for intercept the event & prevent open
> > reminder window?
> >
> > for your info, Here is my code
> > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > Dim WithEvents myolapp As Outlook.Application
> >
> > Private Sub Application_Startup()
> > Initialize_handler
> > End Sub
> >
> > Sub Initialize_handler()
> > Set myolapp = Outlook.Application
> > End Sub
> >
> > Private Sub myolapp_Reminder(ByVal Item As Object)
> > Interval = DateDiff("s", Now(), Item.End) 'seconds
> > EnableTimer Interval * 1000, Me 'first
> > parameter=milliseconds
> > ' I'll add sql query here
> > SetApptColorLabel Item, 5
> > End Sub
> > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> >
> > Thanks,
> > soworl
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Mon Feb 04, 2008 8:46 pm    Post subject: Re: close reminder window programatically Reply with quote

Are any macros working? What happens if you put the cursor in
Application_Startup() and press F5, does the code run and then initialize
the event handlers?

The code is in ThisOutlookSession?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> thanks for your help.
>
> I modified my source for test, but it's not working.
> I cannot see the msg box, "Do you want to view the reminder"
>
> do you know what's wrong?
>
> Thanks,
> soworl
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Dim WithEvents myolapp As Outlook.Application
> Dim WithEvents colReminders As Reminders
>
> Private Sub Application_Startup()
> Initialize_handler
> End Sub
>
> Sub Initialize_handler()
> Set myolapp = Outlook.Application
> Set colReminders = myolapp.Reminders
> End Sub
>
> Private Sub myolapp_Reminder(ByVal Item As Object)
> Interval = DateDiff("s", Now(), Item.End) 'seconds
> EnableTimer Interval * 1000, Me 'first
> parameter=milliseconds
> SetApptColorLabel Item, 5
> 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
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Mon Feb 04, 2008 7:23 pm    Post subject: Re: close reminder window programatically Reply with quote

so rear..

the code is in thisOutlookSession.
it used to call myolapp_Reminder, but not now.


"Ken Slovak - [MVP - Outlook]" wrote:

> Are any macros working? What happens if you put the cursor in
> Application_Startup() and press F5, does the code run and then initialize
> the event handlers?
>
> The code is in ThisOutlookSession?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > thanks for your help.
> >
> > I modified my source for test, but it's not working.
> > I cannot see the msg box, "Do you want to view the reminder"
> >
> > do you know what's wrong?
> >
> > Thanks,
> > soworl
> > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > Dim WithEvents myolapp As Outlook.Application
> > Dim WithEvents colReminders As Reminders
> >
> > Private Sub Application_Startup()
> > Initialize_handler
> > End Sub
> >
> > Sub Initialize_handler()
> > Set myolapp = Outlook.Application
> > Set colReminders = myolapp.Reminders
> > End Sub
> >
> > Private Sub myolapp_Reminder(ByVal Item As Object)
> > Interval = DateDiff("s", Now(), Item.End) 'seconds
> > EnableTimer Interval * 1000, Me 'first
> > parameter=milliseconds
> > SetApptColorLabel Item, 5
> > 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
> > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Tue Feb 05, 2008 2:55 pm    Post subject: Re: close reminder window programatically Reply with quote

Are any macros working?

What happens if you put the cursor in Application_Startup() and press F5,
does the code run and then initialize the event handlers?

What are your macro security settings (Tools, Macros, Security)?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> so rear..
>
> the code is in thisOutlookSession.
> it used to call myolapp_Reminder, but not now.
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Tue Feb 05, 2008 12:35 pm    Post subject: Re: close reminder window programatically Reply with quote

security settings : medium

> What happens if you put the cursor in Application_Startup() and press F5,
-> nothing T.T

when i run the outlook, it asks whether enable macro or not.
I click enable macro.


"Ken Slovak - [MVP - Outlook]" wrote:

> Are any macros working?
>
> What happens if you put the cursor in Application_Startup() and press F5,
> does the code run and then initialize the event handlers?
>
> What are your macro security settings (Tools, Macros, Security)?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > so rear..
> >
> > the code is in thisOutlookSession.
> > it used to call myolapp_Reminder, but not now.
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Tue Feb 05, 2008 4:03 pm    Post subject: Re: close reminder window programatically Reply with quote

Show the exact code you're currently using.

So if you press F5 in that Application_Startup() code it runs and without
any errors?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> security settings : medium
>
>> What happens if you put the cursor in Application_Startup() and press F5,
> -> nothing T.T
>
> when i run the outlook, it asks whether enable macro or not.
> I click enable macro.
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Tue Feb 05, 2008 1:36 pm    Post subject: Re: close reminder window programatically Reply with quote

Hi,

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Application_Startup()
Initialize_handler
End Sub

Private Sub Application_Quit()
DisableTime
End Sub

Public Sub Initialize_handler()
msgBox "Hi1"
End Sub

Private Sub Application_Reminder(ByVal Item As Object)
msgBox "Hi2"
Interval = DateDiff("s", Now(), Item.End) 'seconds
EnableTimer Interval * 1000, Me 'first parameter=milliseconds
SetApptColorLabel Item, 7
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I fixed some code.
Now, Above code is running code. it works fine. I can get msg box, "Hi1" and
"H2".
but I don't know how can I put below sub.
I tested "Application_BeforeReminderShow" and "Reminders_BeforeReminderShow".
Neither can catch BeforeReminderShow.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Reminders_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

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

"Ken Slovak - [MVP - Outlook]" wrote:

> Show the exact code you're currently using.
>
> So if you press F5 in that Application_Startup() code it runs and without
> any errors?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > security settings : medium
> >
> >> What happens if you put the cursor in Application_Startup() and press F5,
> > -> nothing T.T
> >
> > when i run the outlook, it asks whether enable macro or not.
> > I click enable macro.
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Tue Feb 05, 2008 7:10 pm    Post subject: Re: close reminder window programatically Reply with quote

If you look in the Object Browser you will see that there is no
Application_BeforeReminderShow() event, which is a good reason that you
can't trap that event.

Add this to the module level declarations:

Private WithEvents colReminders As Outlook.Reminders

Add this to Initialize_handler():

Set colReminders = Application.Reminders

Then an event handler like this should fire before the reminder window is
displayed:

Private Sub colReminders_BeforeReminderShow(Cancel As Boolean)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> Hi,
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Private Sub Application_Startup()
> Initialize_handler
> End Sub
>
> Private Sub Application_Quit()
> DisableTime
> End Sub
>
> Public Sub Initialize_handler()
> msgBox "Hi1"
> End Sub
>
> Private Sub Application_Reminder(ByVal Item As Object)
> msgBox "Hi2"
> Interval = DateDiff("s", Now(), Item.End) 'seconds
> EnableTimer Interval * 1000, Me 'first
> parameter=milliseconds
> SetApptColorLabel Item, 7
> End Sub
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> I fixed some code.
> Now, Above code is running code. it works fine. I can get msg box, "Hi1"
> and
> "H2".
> but I don't know how can I put below sub.
> I tested "Application_BeforeReminderShow" and
> "Reminders_BeforeReminderShow".
> Neither can catch BeforeReminderShow.
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Private Sub Reminders_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
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Tue Feb 05, 2008 4:39 pm    Post subject: Re: close reminder window programatically Reply with quote

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''''''''''''''''''''''''''''''''''''''''''
'
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
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

"Ken Slovak - [MVP - Outlook]" wrote:

> If you look in the Object Browser you will see that there is no
> Application_BeforeReminderShow() event, which is a good reason that you
> can't trap that event.
>
> Add this to the module level declarations:
>
> Private WithEvents colReminders As Outlook.Reminders
>
> Add this to Initialize_handler():
>
> Set colReminders = Application.Reminders
>
> Then an event handler like this should fire before the reminder window is
> displayed:
>
> Private Sub colReminders_BeforeReminderShow(Cancel As Boolean)
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > Hi,
> >
> > ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > Private Sub Application_Startup()
> > Initialize_handler
> > End Sub
> >
> > Private Sub Application_Quit()
> > DisableTime
> > End Sub
> >
> > Public Sub Initialize_handler()
> > msgBox "Hi1"
> > End Sub
> >
> > Private Sub Application_Reminder(ByVal Item As Object)
> > msgBox "Hi2"
> > Interval = DateDiff("s", Now(), Item.End) 'seconds
> > EnableTimer Interval * 1000, Me 'first
> > parameter=milliseconds
> > SetApptColorLabel Item, 7
> > End Sub
> > ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > I fixed some code.
> > Now, Above code is running code. it works fine. I can get msg box, "Hi1"
> > and
> > "H2".
> > but I don't know how can I put below sub.
> > I tested "Application_BeforeReminderShow" and
> > "Reminders_BeforeReminderShow".
> > Neither can catch BeforeReminderShow.
> >
> > ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > Private Sub Reminders_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
> >
> > ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
>
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Tue Feb 05, 2008 9:25 pm    Post subject: Re: close reminder window programatically Reply with quote

As I mentioned originally, way back in this thread ,you will need to handle
an additional event to get the reminder that is actually firing. You can try
using Application_Reminder() or Reminders.ReminderFire() and see which best
meets your needs.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"soworl" wrote in message @microsoft.com...
> 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''''''''''''''''''''''''''''''''''''''''''
> '
> 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
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Back to top
View user's profile Send private message
soworl



Joined: 17 Jan 2008
Posts: 12

PostPosted: Tue Feb 05, 2008 8:12 pm    Post subject: Re: close reminder window programatically Reply with quote

Hi,

I found way to get Appointment item object, see below code.
but I get another problem - -;
Even I set objItem.ReminderSet = False, it is called multiple.
I want to call doSomething just one time.

Thanks for your help.
soworl
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub colReminders_BeforeReminderShow(Cancel As Boolean)
Cancel = True
doSomething
End Sub

Public Sub doSomething()
Dim objRem As Reminder
Dim objItem As Object

If colReminders.Count 0 Then
For Each objRem In colReminders
Set objItem = objRem.Item
msgBox objItem.End
SetApptColorLabel objItem, 4
objItem.ReminderSet = False
Next
Else
MsgBox "There are no reminders in the collection."
End If
Set objItem = Nothing
Set objRem = Nothing
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"Ken Slovak - [MVP - Outlook]" wrote:

> As I mentioned originally, way back in this thread ,you will need to handle
> an additional event to get the reminder that is actually firing. You can try
> using Application_Reminder() or Reminders.ReminderFire() and see which best
> meets your needs.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "soworl" wrote in message
> @microsoft.com...
> > 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''''''''''''''''''''''''''''''''''''''''''
> > '
> > 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
> > ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
How to Force the Reminder Window to Pop-Up Hello I want to force the Reminder Window to Pop-Up. Currently, sometimes, it only flashes the Taksbar; and sometimes it does pop-up. If I'm not paying attention or stepped away, I don't notice the reminder window. In the event, I t

Turn off reminders programatically Outlook 2007 SP1/Exchange 2007 I want to turn off reminders for all 'all day' events that I receive. Can anyone give me some guidance of how I might do this. I have some experience of using VBA, but none with Outlook. Thanks for any help.

How to Force the Reminder Window to Pop-Up Hello I want to force the Reminder Window to Pop-Up. Currently, sometimes, it only flashes the Taksbar; and sometimes it does pop-up. If I'm not paying attention or stepped away, I don't notice the reminder window. Thanks.

Exchange/Outlook-Synchronization programatically hi, i use Exchange 2003 and Outlook 2003. I'm developing an application in VB.NET. My question: When i insert data in a taskform in Outlook 2003, they aren't immediately in the But I need the data in my

Custom form not saving when fields changed programatically Is there a way to force a form as "dirty" so Outlook attempts to save it if someone clicks the 'X'? I am changing the HTMLBody and even a custom field but the if I click the 'X' then the form closes without saving. If I change any field using the GUI then
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Program VBA All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group