PC Review


Reply
Thread Tools Rate Thread

Application_Startup doesn't seem to work - Outlook 2007

 
 
Old Man River
Guest
Posts: n/a
 
      16th Nov 2009
I have the following code in Class1 code

Option Explicit
Public WithEvents objReminders As Outlook.Reminders

Sub Initialize_handler()
Set objReminders = Application.Reminders
MsgBox "Reminder handler initialized"
End Sub

Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
With ReminderObject
' irelevant code removed
.Item.Display
MsgBox .Caption
.Dismiss
End With
End Sub

And this in Module1 code

Option Explicit

Private Sub Application_Startup()
Dim MyClass As New Class1
MyClass.Initialize_handler
End Sub

The "Reminder handler initialized" doesn't get displayed on starting Outlook
and the event handler doesn't trigger.

What am I doing wrong?
 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      16th Nov 2009


Why do you use another class module? The issues are:

1) Outlook expects Application_Startup in the ThisOutlookSession module. It
doesn't find the procedure in any other module.

2) The Myclass variable needs to be declared on a module level. Declared in
a procedure, the object will terminate as soon as the last line of it has
been executed.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 16 Nov 2009 09:15:03 -0800 schrieb Old Man River:

> I have the following code in Class1 code
>
> Option Explicit
> Public WithEvents objReminders As Outlook.Reminders
>
> Sub Initialize_handler()
> Set objReminders = Application.Reminders
> MsgBox "Reminder handler initialized"
> End Sub
>
> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> With ReminderObject
> ' irelevant code removed
> .Item.Display
> MsgBox .Caption
> .Dismiss
> End With
> End Sub
>
> And this in Module1 code
>
> Option Explicit
>
> Private Sub Application_Startup()
> Dim MyClass As New Class1
> MyClass.Initialize_handler
> End Sub
>
> The "Reminder handler initialized" doesn't get displayed on starting

Outlook
> and the event handler doesn't trigger.
>
> What am I doing wrong?

 
Reply With Quote
 
Old Man River
Guest
Posts: n/a
 
      17th Nov 2009
Thanks Michael

This is my first Outlook project (I've been a programmer for over 40 years
though now retired). I'd made the mistake in getting to the code section by
going in via the Visual Basic Editor menu item which creates the
Module1(Code) Module so hadn't found the

ThisOutlookSession(Code) Module.

I'd followed the instructions in Help ("Using Events with Automation" and
"Reminders.ReminderFire Event") to create the Class1(Code) Module as
instructed and I presume I should keep that. Although I cannot see how to
rename the module from Class1 to something more meaningful.

I have now moved this code to ThisOutlookSession viz:

Option Explicit

Dim MyClass As New Class1

Private Sub Application_Startup()
MyClass.Initialize_handler
Application.ActiveExplorer.WindowState = olMaximized
End Sub

Sub Init()
MyClass.Initialize_handler
End Sub

And because again Application_Startup did not fire I added the Sub Init
which I can call from the Macro Menu. After a bit of a struggle certificating
myself. I find that Application_Startup still does not fire but I get my
"Reminder Handler Initialised" prompt when running the Init Macro from the
menu but nothing happens when a reminder fires.

Strange this, as I was getting a result manually calling an Init sub when
the code was in the Module1(Code) Module and I hadn't had to use a
certificate!

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Why do you use another class module? The issues are:
>
> 1) Outlook expects Application_Startup in the ThisOutlookSession module. It
> doesn't find the procedure in any other module.
>
> 2) The Myclass variable needs to be declared on a module level. Declared in
> a procedure, the object will terminate as soon as the last line of it has
> been executed.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
>
> : Outlook Categories? Category Manager Is Your Tool
> : VBOffice Reporter for Data Analysis & Reporting
> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>
>
> Am Mon, 16 Nov 2009 09:15:03 -0800 schrieb Old Man River:
>
> > I have the following code in Class1 code
> >
> > Option Explicit
> > Public WithEvents objReminders As Outlook.Reminders
> >
> > Sub Initialize_handler()
> > Set objReminders = Application.Reminders
> > MsgBox "Reminder handler initialized"
> > End Sub
> >
> > Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> > With ReminderObject
> > ' irelevant code removed
> > .Item.Display
> > MsgBox .Caption
> > .Dismiss
> > End With
> > End Sub
> >
> > And this in Module1 code
> >
> > Option Explicit
> >
> > Private Sub Application_Startup()
> > Dim MyClass As New Class1
> > MyClass.Initialize_handler
> > End Sub
> >
> > The "Reminder handler initialized" doesn't get displayed on starting

> Outlook
> > and the event handler doesn't trigger.
> >
> > What am I doing wrong?

> .
>

 
Reply With Quote
 
Old Man River
Guest
Posts: n/a
 
      17th Nov 2009

Thanks Michael

This is my first Outlook project (I've been a programmer for over 40 years
though now retired). I'd made the mistake in getting to the code section by
going in via the Visual Basic Editor menu item which creates the
Module1(Code) Module so hadn't found the

ThisOutlookSession(Code) Module.

I'd followed the instructions in Help ("Using Events with Automation" and
"Reminders.ReminderFire Event") to create the Class1(Code) Module as
instructed and I presume I should keep that. Although I cannot see how to
rename the module from Class1 to something more meaningful.

I have now moved this code to ThisOutlookSession viz:

Option Explicit

Dim MyClass As New Class1

Private Sub Application_Startup()
MyClass.Initialize_handler
Application.ActiveExplorer.WindowState = olMaximized
End Sub

Sub Init()
MyClass.Initialize_handler
End Sub

And because again Application_Startup did not fire I added the Sub Init
which I can call from the Macro Menu. After a bit of a struggle certificating
myself. I find that Application_Startup still does not fire but I get my
"Reminder Handler Initialised" prompt when running the Init Macro from the
menu but nothing happens when a reminder fires.

Strange this, as I was getting a result manually calling an Init sub when
the code was in the Module1(Code) Module and I hadn't had to use a
certificate!
"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Why do you use another class module? The issues are:
>
> 1) Outlook expects Application_Startup in the ThisOutlookSession module. It
> doesn't find the procedure in any other module.
>
> 2) The Myclass variable needs to be declared on a module level. Declared in
> a procedure, the object will terminate as soon as the last line of it has
> been executed.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
>
> : Outlook Categories? Category Manager Is Your Tool
> : VBOffice Reporter for Data Analysis & Reporting
> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>
>
> Am Mon, 16 Nov 2009 09:15:03 -0800 schrieb Old Man River:
>
> > I have the following code in Class1 code
> >
> > Option Explicit
> > Public WithEvents objReminders As Outlook.Reminders
> >
> > Sub Initialize_handler()
> > Set objReminders = Application.Reminders
> > MsgBox "Reminder handler initialized"
> > End Sub
> >
> > Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> > With ReminderObject
> > ' irelevant code removed
> > .Item.Display
> > MsgBox .Caption
> > .Dismiss
> > End With
> > End Sub
> >
> > And this in Module1 code
> >
> > Option Explicit
> >
> > Private Sub Application_Startup()
> > Dim MyClass As New Class1
> > MyClass.Initialize_handler
> > End Sub
> >
> > The "Reminder handler initialized" doesn't get displayed on starting

> Outlook
> > and the event handler doesn't trigger.
> >
> > What am I doing wrong?

> .
>

 
Reply With Quote
 
Old Man River
Guest
Posts: n/a
 
      17th Nov 2009
I have placed all code in ThisOutlookSession (see below). I have signed it
with a certificate using the MS "Digital Certificate for VBA Projects" tool.
I have deleted the original VBAProject.OTM file yet still the
Application_Startup sub fails to trigger. Running the Init sub from the Tools
- Macro menu does the initilisation and the code then fires when a reminder
is fired. Why is this happening?

Running under Windows Vista Home Premium

Option Explicit

Public WithEvents objReminders As Outlook.Reminders

Private Sub Initialize_handler()
Set objReminders = Application.Reminders
MsgBox "Reminder handler initialised"
End Sub

Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
With ReminderObject
Stop
If .Caption = "Fence Check Reminder" Then
.Item.Display
.Dismiss
End If
End With
End Sub

Private Sub Application_Startup()
Stop
Initialize_handler
Application.ActiveExplorer.WindowState = olMaximized
End Sub

Sub Init()
Initialize_handler
End Sub


"Old Man River" wrote:

> I have the following code in Class1 code
>
> Option Explicit
> Public WithEvents objReminders As Outlook.Reminders
>
> Sub Initialize_handler()
> Set objReminders = Application.Reminders
> MsgBox "Reminder handler initialized"
> End Sub
>
> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> With ReminderObject
> ' irelevant code removed
> .Item.Display
> MsgBox .Caption
> .Dismiss
> End With
> End Sub
>
> And this in Module1 code
>
> Option Explicit
>
> Private Sub Application_Startup()
> Dim MyClass As New Class1
> MyClass.Initialize_handler
> End Sub
>
> The "Reminder handler initialized" doesn't get displayed on starting Outlook
> and the event handler doesn't trigger.
>
> What am I doing wrong?

 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      17th Nov 2009


What do you think a Stop call would do? I'd assume it stops the code from
any further execution.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Tue, 17 Nov 2009 09:25:03 -0800 schrieb Old Man River:

> I have placed all code in ThisOutlookSession (see below). I have signed it
> with a certificate using the MS "Digital Certificate for VBA Projects"

tool.
> I have deleted the original VBAProject.OTM file yet still the
> Application_Startup sub fails to trigger. Running the Init sub from the

Tools
> - Macro menu does the initilisation and the code then fires when a

reminder
> is fired. Why is this happening?
>
> Running under Windows Vista Home Premium
>
> Option Explicit
>
> Public WithEvents objReminders As Outlook.Reminders
>
> Private Sub Initialize_handler()
> Set objReminders = Application.Reminders
> MsgBox "Reminder handler initialised"
> End Sub
>
> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> With ReminderObject
> Stop
> If .Caption = "Fence Check Reminder" Then
> .Item.Display
> .Dismiss
> End If
> End With
> End Sub
>
> Private Sub Application_Startup()
> Stop
> Initialize_handler
> Application.ActiveExplorer.WindowState = olMaximized
> End Sub
>
> Sub Init()
> Initialize_handler
> End Sub
>
>
> "Old Man River" wrote:
>
>> I have the following code in Class1 code
>>
>> Option Explicit
>> Public WithEvents objReminders As Outlook.Reminders
>>
>> Sub Initialize_handler()
>> Set objReminders = Application.Reminders
>> MsgBox "Reminder handler initialized"
>> End Sub
>>
>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
>> With ReminderObject
>> ' irelevant code removed
>> .Item.Display
>> MsgBox .Caption
>> .Dismiss
>> End With
>> End Sub
>>
>> And this in Module1 code
>>
>> Option Explicit
>>
>> Private Sub Application_Startup()
>> Dim MyClass As New Class1
>> MyClass.Initialize_handler
>> End Sub
>>
>> The "Reminder handler initialized" doesn't get displayed on starting

Outlook
>> and the event handler doesn't trigger.
>>
>> What am I doing wrong?

 
Reply With Quote
 
Old Man River
Guest
Posts: n/a
 
      18th Nov 2009
It halts the code a that poind and launches the debugger. Very useful in
developing event driven code and in debugging large amounts of code that you
do not want to have to watch. Unlike setting a breakpoint it suvives closing
the application and relaunching. Obviously doesn't work in a compiled
..com/.exe file where it acts like an End statement.

Still not making any progress with the Application_Startup problem though.

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> What do you think a Stop call would do? I'd assume it stops the code from
> any further execution.
>
> --
> Best regards
> Michael Bauer - MVP Outlook
>
> : Outlook Categories? Category Manager Is Your Tool
> : VBOffice Reporter for Data Analysis & Reporting
> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>
>
> Am Tue, 17 Nov 2009 09:25:03 -0800 schrieb Old Man River:
>
> > I have placed all code in ThisOutlookSession (see below). I have signed it
> > with a certificate using the MS "Digital Certificate for VBA Projects"

> tool.
> > I have deleted the original VBAProject.OTM file yet still the
> > Application_Startup sub fails to trigger. Running the Init sub from the

> Tools
> > - Macro menu does the initilisation and the code then fires when a

> reminder
> > is fired. Why is this happening?
> >
> > Running under Windows Vista Home Premium
> >
> > Option Explicit
> >
> > Public WithEvents objReminders As Outlook.Reminders
> >
> > Private Sub Initialize_handler()
> > Set objReminders = Application.Reminders
> > MsgBox "Reminder handler initialised"
> > End Sub
> >
> > Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> > With ReminderObject
> > Stop
> > If .Caption = "Fence Check Reminder" Then
> > .Item.Display
> > .Dismiss
> > End If
> > End With
> > End Sub
> >
> > Private Sub Application_Startup()
> > Stop
> > Initialize_handler
> > Application.ActiveExplorer.WindowState = olMaximized
> > End Sub
> >
> > Sub Init()
> > Initialize_handler
> > End Sub
> >
> >
> > "Old Man River" wrote:
> >
> >> I have the following code in Class1 code
> >>
> >> Option Explicit
> >> Public WithEvents objReminders As Outlook.Reminders
> >>
> >> Sub Initialize_handler()
> >> Set objReminders = Application.Reminders
> >> MsgBox "Reminder handler initialized"
> >> End Sub
> >>
> >> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> >> With ReminderObject
> >> ' irelevant code removed
> >> .Item.Display
> >> MsgBox .Caption
> >> .Dismiss
> >> End With
> >> End Sub
> >>
> >> And this in Module1 code
> >>
> >> Option Explicit
> >>
> >> Private Sub Application_Startup()
> >> Dim MyClass As New Class1
> >> MyClass.Initialize_handler
> >> End Sub
> >>
> >> The "Reminder handler initialized" doesn't get displayed on starting

> Outlook
> >> and the event handler doesn't trigger.
> >>
> >> What am I doing wrong?

> .
>

 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      18th Nov 2009


Have you tried it without calling Stop?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 18 Nov 2009 00:25:01 -0800 schrieb Old Man River:

> It halts the code a that poind and launches the debugger. Very useful in
> developing event driven code and in debugging large amounts of code that

you
> do not want to have to watch. Unlike setting a breakpoint it suvives

closing
> the application and relaunching. Obviously doesn't work in a compiled
> .com/.exe file where it acts like an End statement.
>
> Still not making any progress with the Application_Startup problem though.
>
> "Michael Bauer [MVP - Outlook]" wrote:
>
>>
>>
>> What do you think a Stop call would do? I'd assume it stops the code from
>> any further execution.
>>
>> --
>> Best regards
>> Michael Bauer - MVP Outlook
>>
>> : Outlook Categories? Category Manager Is Your Tool
>> : VBOffice Reporter for Data Analysis & Reporting
>> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>>
>>
>> Am Tue, 17 Nov 2009 09:25:03 -0800 schrieb Old Man River:
>>
>>> I have placed all code in ThisOutlookSession (see below). I have signed

it
>>> with a certificate using the MS "Digital Certificate for VBA Projects"

>> tool.
>>> I have deleted the original VBAProject.OTM file yet still the
>>> Application_Startup sub fails to trigger. Running the Init sub from the

>> Tools
>>> - Macro menu does the initilisation and the code then fires when a

>> reminder
>>> is fired. Why is this happening?
>>>
>>> Running under Windows Vista Home Premium
>>>
>>> Option Explicit
>>>
>>> Public WithEvents objReminders As Outlook.Reminders
>>>
>>> Private Sub Initialize_handler()
>>> Set objReminders = Application.Reminders
>>> MsgBox "Reminder handler initialised"
>>> End Sub
>>>
>>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
>>> With ReminderObject
>>> Stop
>>> If .Caption = "Fence Check Reminder" Then
>>> .Item.Display
>>> .Dismiss
>>> End If
>>> End With
>>> End Sub
>>>
>>> Private Sub Application_Startup()
>>> Stop
>>> Initialize_handler
>>> Application.ActiveExplorer.WindowState = olMaximized
>>> End Sub
>>>
>>> Sub Init()
>>> Initialize_handler
>>> End Sub
>>>
>>>
>>> "Old Man River" wrote:
>>>
>>>> I have the following code in Class1 code
>>>>
>>>> Option Explicit
>>>> Public WithEvents objReminders As Outlook.Reminders
>>>>
>>>> Sub Initialize_handler()
>>>> Set objReminders = Application.Reminders
>>>> MsgBox "Reminder handler initialized"
>>>> End Sub
>>>>
>>>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
>>>> With ReminderObject
>>>> ' irelevant code removed
>>>> .Item.Display
>>>> MsgBox .Caption
>>>> .Dismiss
>>>> End With
>>>> End Sub
>>>>
>>>> And this in Module1 code
>>>>
>>>> Option Explicit
>>>>
>>>> Private Sub Application_Startup()
>>>> Dim MyClass As New Class1
>>>> MyClass.Initialize_handler
>>>> End Sub
>>>>
>>>> The "Reminder handler initialized" doesn't get displayed on starting

>> Outlook
>>>> and the event handler doesn't trigger.
>>>>
>>>> What am I doing wrong?

>> .
>>

 
Reply With Quote
 
Old Man River
Guest
Posts: n/a
 
      18th Nov 2009
Just tried it with both Stop's commented out. No change even commented out
the Private Sub Application_Startup() statement and reentered it. It just
refuses to fire when I launch Outlook. I have stepped through it and it works
so it's not an invisible charater in the code or some other such trifle.

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Have you tried it without calling Stop?
>
> --
> Best regards
> Michael Bauer - MVP Outlook
>
> : Outlook Categories? Category Manager Is Your Tool
> : VBOffice Reporter for Data Analysis & Reporting
> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>
>
> Am Wed, 18 Nov 2009 00:25:01 -0800 schrieb Old Man River:
>
> > It halts the code a that poind and launches the debugger. Very useful in
> > developing event driven code and in debugging large amounts of code that

> you
> > do not want to have to watch. Unlike setting a breakpoint it suvives

> closing
> > the application and relaunching. Obviously doesn't work in a compiled
> > .com/.exe file where it acts like an End statement.
> >
> > Still not making any progress with the Application_Startup problem though.
> >
> > "Michael Bauer [MVP - Outlook]" wrote:
> >
> >>
> >>
> >> What do you think a Stop call would do? I'd assume it stops the code from
> >> any further execution.
> >>
> >> --
> >> Best regards
> >> Michael Bauer - MVP Outlook
> >>
> >> : Outlook Categories? Category Manager Is Your Tool
> >> : VBOffice Reporter for Data Analysis & Reporting
> >> : <http://www.vboffice.net/product.html?pub=6&lang=en>
> >>
> >>
> >> Am Tue, 17 Nov 2009 09:25:03 -0800 schrieb Old Man River:
> >>
> >>> I have placed all code in ThisOutlookSession (see below). I have signed

> it
> >>> with a certificate using the MS "Digital Certificate for VBA Projects"
> >> tool.
> >>> I have deleted the original VBAProject.OTM file yet still the
> >>> Application_Startup sub fails to trigger. Running the Init sub from the
> >> Tools
> >>> - Macro menu does the initilisation and the code then fires when a
> >> reminder
> >>> is fired. Why is this happening?
> >>>
> >>> Running under Windows Vista Home Premium
> >>>
> >>> Option Explicit
> >>>
> >>> Public WithEvents objReminders As Outlook.Reminders
> >>>
> >>> Private Sub Initialize_handler()
> >>> Set objReminders = Application.Reminders
> >>> MsgBox "Reminder handler initialised"
> >>> End Sub
> >>>
> >>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> >>> With ReminderObject
> >>> Stop
> >>> If .Caption = "Fence Check Reminder" Then
> >>> .Item.Display
> >>> .Dismiss
> >>> End If
> >>> End With
> >>> End Sub
> >>>
> >>> Private Sub Application_Startup()
> >>> Stop
> >>> Initialize_handler
> >>> Application.ActiveExplorer.WindowState = olMaximized
> >>> End Sub
> >>>
> >>> Sub Init()
> >>> Initialize_handler
> >>> End Sub
> >>>
> >>>
> >>> "Old Man River" wrote:
> >>>
> >>>> I have the following code in Class1 code
> >>>>
> >>>> Option Explicit
> >>>> Public WithEvents objReminders As Outlook.Reminders
> >>>>
> >>>> Sub Initialize_handler()
> >>>> Set objReminders = Application.Reminders
> >>>> MsgBox "Reminder handler initialized"
> >>>> End Sub
> >>>>
> >>>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
> >>>> With ReminderObject
> >>>> ' irelevant code removed
> >>>> .Item.Display
> >>>> MsgBox .Caption
> >>>> .Dismiss
> >>>> End With
> >>>> End Sub
> >>>>
> >>>> And this in Module1 code
> >>>>
> >>>> Option Explicit
> >>>>
> >>>> Private Sub Application_Startup()
> >>>> Dim MyClass As New Class1
> >>>> MyClass.Initialize_handler
> >>>> End Sub
> >>>>
> >>>> The "Reminder handler initialized" doesn't get displayed on starting
> >> Outlook
> >>>> and the event handler doesn't trigger.
> >>>>
> >>>> What am I doing wrong?
> >> .
> >>

> .
>

 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      18th Nov 2009

If Application_Startup really is in ThisOutlookSession, that's weird. What
happens if you set macro security to the lowest level?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Wed, 18 Nov 2009 03:04:03 -0800 schrieb Old Man River:

> Just tried it with both Stop's commented out. No change even commented out
> the Private Sub Application_Startup() statement and reentered it. It just
> refuses to fire when I launch Outlook. I have stepped through it and it

works
> so it's not an invisible charater in the code or some other such trifle.
>
> "Michael Bauer [MVP - Outlook]" wrote:
>
>>
>>
>> Have you tried it without calling Stop?
>>
>> --
>> Best regards
>> Michael Bauer - MVP Outlook
>>
>> : Outlook Categories? Category Manager Is Your Tool
>> : VBOffice Reporter for Data Analysis & Reporting
>> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>>
>>
>> Am Wed, 18 Nov 2009 00:25:01 -0800 schrieb Old Man River:
>>
>>> It halts the code a that poind and launches the debugger. Very useful in
>>> developing event driven code and in debugging large amounts of code that

>> you
>>> do not want to have to watch. Unlike setting a breakpoint it suvives

>> closing
>>> the application and relaunching. Obviously doesn't work in a compiled
>>> .com/.exe file where it acts like an End statement.
>>>
>>> Still not making any progress with the Application_Startup problem

though.
>>>
>>> "Michael Bauer [MVP - Outlook]" wrote:
>>>
>>>>
>>>>
>>>> What do you think a Stop call would do? I'd assume it stops the code

from
>>>> any further execution.
>>>>
>>>> --
>>>> Best regards
>>>> Michael Bauer - MVP Outlook
>>>>
>>>> : Outlook Categories? Category Manager Is Your Tool
>>>> : VBOffice Reporter for Data Analysis & Reporting
>>>> : <http://www.vboffice.net/product.html?pub=6&lang=en>
>>>>
>>>>
>>>> Am Tue, 17 Nov 2009 09:25:03 -0800 schrieb Old Man River:
>>>>
>>>>> I have placed all code in ThisOutlookSession (see below). I have

signed
>> it
>>>>> with a certificate using the MS "Digital Certificate for VBA Projects"
>>>> tool.
>>>>> I have deleted the original VBAProject.OTM file yet still the
>>>>> Application_Startup sub fails to trigger. Running the Init sub from

the
>>>> Tools
>>>>> - Macro menu does the initilisation and the code then fires when a
>>>> reminder
>>>>> is fired. Why is this happening?
>>>>>
>>>>> Running under Windows Vista Home Premium
>>>>>
>>>>> Option Explicit
>>>>>
>>>>> Public WithEvents objReminders As Outlook.Reminders
>>>>>
>>>>> Private Sub Initialize_handler()
>>>>> Set objReminders = Application.Reminders
>>>>> MsgBox "Reminder handler initialised"
>>>>> End Sub
>>>>>
>>>>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As

Reminder)
>>>>> With ReminderObject
>>>>> Stop
>>>>> If .Caption = "Fence Check Reminder" Then
>>>>> .Item.Display
>>>>> .Dismiss
>>>>> End If
>>>>> End With
>>>>> End Sub
>>>>>
>>>>> Private Sub Application_Startup()
>>>>> Stop
>>>>> Initialize_handler
>>>>> Application.ActiveExplorer.WindowState = olMaximized
>>>>> End Sub
>>>>>
>>>>> Sub Init()
>>>>> Initialize_handler
>>>>> End Sub
>>>>>
>>>>>
>>>>> "Old Man River" wrote:
>>>>>
>>>>>> I have the following code in Class1 code
>>>>>>
>>>>>> Option Explicit
>>>>>> Public WithEvents objReminders As Outlook.Reminders
>>>>>>
>>>>>> Sub Initialize_handler()
>>>>>> Set objReminders = Application.Reminders
>>>>>> MsgBox "Reminder handler initialized"
>>>>>> End Sub
>>>>>>
>>>>>> Private Sub objReminders_ReminderFire(ByVal ReminderObject As

Reminder)
>>>>>> With ReminderObject
>>>>>> ' irelevant code removed
>>>>>> .Item.Display
>>>>>> MsgBox .Caption
>>>>>> .Dismiss
>>>>>> End With
>>>>>> End Sub
>>>>>>
>>>>>> And this in Module1 code
>>>>>>
>>>>>> Option Explicit
>>>>>>
>>>>>> Private Sub Application_Startup()
>>>>>> Dim MyClass As New Class1
>>>>>> MyClass.Initialize_handler
>>>>>> End Sub
>>>>>>
>>>>>> The "Reminder handler initialized" doesn't get displayed on starting
>>>> Outlook
>>>>>> and the event handler doesn't trigger.
>>>>>>
>>>>>> What am I doing wrong?
>>>> .
>>>>

>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 just doesn't work!? Al Microsoft Outlook Installation 2 24th Sep 2009 07:02 PM
Outlook 2007: RSS doesn't work. . . Carmen Gauvin-O'Donnell Microsoft Outlook Discussion 0 2nd Mar 2007 12:02 PM
Application_startup will not work dantroppmann@riversidehonda.com Microsoft Outlook VBA Programming 3 25th Feb 2006 09:55 AM
Application_StartUp doesn't run with CreateObject("Outlook.Application") Gabi Fruhner Microsoft Outlook VBA Programming 1 2nd Dec 2004 12:27 AM
Re: Application_Startup() doesn't run Ken Slovak - [MVP - Outlook] Microsoft Outlook VBA Programming 0 9th Jul 2004 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:39 PM.