Application_Startup doesn't seem to work - Outlook 2007

Status
Not open for further replies.
O

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?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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

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?
 
O

Old Man River

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

> > >

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

> .
>
 
O

Old Man River

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

> > >

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

> .
>
 
O

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?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
What do you think a Stop call would do? I'd assume it stops the code from

any further execution.

Best regards

Michael Bauer

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?
 
O

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

> > >

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

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Have you tried it without calling Stop?

Best regards

Michael Bauer

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

>> >> >>

>

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

> > .
> >
 
O

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 " wrote:



> Have you tried it without calling Stop?

> > Best regards
> Michael Bauer

> > >

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

> >
> >
> >> 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?
> >> .
> >>

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
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

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 " wrote:
>
>

>
>> Have you tried it without calling Stop?
>

>> > > Best regards
> > Michael Bauer
>

>> >> >>

>

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

> >>
>>>
>>>> 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?
> >>> .
> >>>

> > .
> >
 
O

Old Man River

Thank you for your patience Michael.

Firstly I can assure you that the code is in ThisOutlookSession. the title

of the window is "Microsoft Visual Basic - VbaProject - [ThisOutlookSession

(Code)]".

So I just tried your suggestions viz:

1. set Macro security to run all macros then

2. removed the certificate.

After both steps I restarted Outlook to no avail. (The Stop remains

commented out.)

The only difference was that I was not prompted to safeve the VBA Project

when I closed Outlook

I have sent a support request to MS.

Many Thanks - Alan

"Michael Bauer " wrote:



> 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

> > >

> 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 " wrote:
> >
> >
> >
> >> Have you tried it without calling Stop?
> >
> >> > >> Best regards
> >> Michael Bauer
> >
> >> > >> > >>

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

> >>>
> >>>
> >>>> 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?
> >>>> .
> >>>
> >> .
> >>

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Please keep us informed.

Best regards

Michael Bauer

Am Thu, 19 Nov 2009 00:38:01 -0800 schrieb Old Man River:


> Thank you for your patience Michael.

> Firstly I can assure you that the code is in ThisOutlookSession. the title
> of the window is "Microsoft Visual Basic - VbaProject -


[ThisOutlookSession
> (Code)]".

> So I just tried your suggestions viz:
> 1. set Macro security to run all macros then
> 2. removed the certificate.

> After both steps I restarted Outlook to no avail. (The Stop remains
> commented out.)
> The only difference was that I was not prompted to safeve the VBA Project
> when I closed Outlook

> I have sent a support request to MS.

> Many Thanks - Alan

> "Michael Bauer " wrote:
>
>

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

>> >> >>

>

>
>
>> 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 " wrote:
> >
>>>
>>>
>>>> Have you tried it without calling Stop?
> >>
>>>> > >>> Best regards
> >>> Michael Bauer
> >>
>>>> >>>> >>>>

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

> >>>>
>>>>>
>>>>>> 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?
> >>>>> .
> >>>>
>>>> .
> >>>

> > .
> >
 
O

Old Man River

Michael - I think I have accidentally found the cause and solved the problem.

I was trying to add a button to a toolbar to call a macro which would do the

initialisation but the button would not stick when closing and re-opening

Outlook, the button just kept dissapearing.

I did a search and found some references to solving this kind of problem by

renaming outcmd.dat which apparently can become corrupted. I did this and now

when I open outlook the Application_Startup sub fires! So no need for the

button or extra sub anymore. will keep the prompt though. Am waiting for MS

to call back - it'll be interesting to see what they suggest before I tell

them.

Something to file in the "If all else fails and you've read the manual, try

this" folder.

Thank you for your interest

Regards

Alan

"Michael Bauer " wrote:



> Please keep us informed.

> > Best regards
> Michael Bauer

> > >

> Am Thu, 19 Nov 2009 00:38:01 -0800 schrieb Old Man River:
>
> > Thank you for your patience Michael.
> > Firstly I can assure you that the code is in ThisOutlookSession. the title
> > of the window is "Microsoft Visual Basic - VbaProject -

> [ThisOutlookSession
> > (Code)]".
> > So I just tried your suggestions viz:
> > 1. set Macro security to run all macros then
> > 2. removed the certificate.
> > After both steps I restarted Outlook to no avail. (The Stop remains
> > commented out.)
> > The only difference was that I was not prompted to safeve the VBA Project
> > when I closed Outlook
> > I have sent a support request to MS.
> > Many Thanks - Alan
> > "Michael Bauer " wrote:
> >
> >
> >> 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
> >
> >> > >> > >>

> >
> >
> >
> >> 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 " wrote:
> >>
> >>>
> >>>
> >>>> Have you tried it without calling Stop?
> >>>
> >>>> > >>>> Best regards
> >>>> Michael Bauer
> >>>
> >>>> > >>>> > >>>>

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

> >>>>>
> >>>>>
> >>>>>> 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?
> >>>>>> .
> >>>>>
> >>>> .
> >>>
> >> .
> >>

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
That's interesting, thanks.

Best regards

Michael Bauer

Am Sun, 22 Nov 2009 05:58:02 -0800 schrieb Old Man River:


> Michael - I think I have accidentally found the cause and solved the


problem.

> I was trying to add a button to a toolbar to call a macro which would do


the
> initialisation but the button would not stick when closing and re-opening
> Outlook, the button just kept dissapearing.

> I did a search and found some references to solving this kind of problem


by
> renaming outcmd.dat which apparently can become corrupted. I did this and


now
> when I open outlook the Application_Startup sub fires! So no need for the
> button or extra sub anymore. will keep the prompt though. Am waiting for


MS
> to call back - it'll be interesting to see what they suggest before I tell
> them.

> Something to file in the "If all else fails and you've read the manual,


try
> this" folder.

> Thank you for your interest

> Regards
> Alan

> "Michael Bauer " wrote:
>
>

>> Please keep us informed.
>

>> > > Best regards
> > Michael Bauer
>

>> >> >>

>

>
>> Am Thu, 19 Nov 2009 00:38:01 -0800 schrieb Old Man River:
> >
> >> Thank you for your patience Michael.
> >
>>> Firstly I can assure you that the code is in ThisOutlookSession. the


title
> >> of the window is "Microsoft Visual Basic - VbaProject -

> > [ThisOutlookSession
> >> (Code)]".
> >
>>> So I just tried your suggestions viz:
> >> 1. set Macro security to run all macros then
> >> 2. removed the certificate.
> >
>>> After both steps I restarted Outlook to no avail. (The Stop remains
> >> commented out.)
> >> The only difference was that I was not prompted to safeve the VBA


Project
> >> when I closed Outlook
> >
>>> I have sent a support request to MS.
> >
>>> Many Thanks - Alan
> >
>>> "Michael Bauer " wrote:
> >
>>>
>>>> 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
> >>
>>>> >>>> >>>>

> >>
>>>
>>>
>>>> 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 " wrote:
> >>>
>>>>>
>>>>>
>>>>>> Have you tried it without calling Stop?
> >>>>
>>>>>> > >>>>> Best regards
> >>>>> Michael Bauer
> >>>>
>>>>>> >>>>>> >>>>>>

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

> >>>>>>
>>>>>>>
>>>>>>>> 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?
> >>>>>>> .
> >>>>>>
>>>>>> .
> >>>>
>>>> .
> >>>

> > .
> >
 
O

Old Man River

On checking I found that the bad Outcmd.dat file had grown to a massive

233,550KB, the new one is only 3KB.

I got some further info from MS. Viz:

"Apparently when we write the outcmd.dat file and VBA is loaded, we check if

there are any Application level events, and if there are, then we set a bit

that tells us to load VBA on boot. So if the outcmd.dat file is not present

or if the bit is not set properly, VBA will not load on boot.

If you want your macro to always be loaded, you could also try to set the

value of the LoadBehavior key to 3. The key is located under

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins\NameOfTheAdd-In

By default, the value is 9, but if you set it to 3, you will always load the

macro and overwrite the default security settings for the respective add-in.

See also http://msdn.microsoft.com/en-us/library/19dax6cz(VS.80).aspx"

I don't think I want to mess with the registry!

"Michael Bauer " wrote:



> That's interesting, thanks.

> > Best regards
> Michael Bauer

> > >

> Am Sun, 22 Nov 2009 05:58:02 -0800 schrieb Old Man River:
>
> > Michael - I think I have accidentally found the cause and solved the

> problem.
> > I was trying to add a button to a toolbar to call a macro which would do

> the
> > initialisation but the button would not stick when closing and re-opening
> > Outlook, the button just kept dissapearing.
> > I did a search and found some references to solving this kind of problem

> by
> > renaming outcmd.dat which apparently can become corrupted. I did this and

> now
> > when I open outlook the Application_Startup sub fires! So no need for the
> > button or extra sub anymore. will keep the prompt though. Am waiting for

> MS
> > to call back - it'll be interesting to see what they suggest before I tell
> > them.
> > Something to file in the "If all else fails and you've read the manual,

> try
> > this" folder.
> > Thank you for your interest
> > Regards
> > Alan
> > "Michael Bauer " wrote:
> >
> >
> >> Please keep us informed.
> >
> >> > >> Best regards
> >> Michael Bauer
> >
> >> > >> > >>

> >
> >
> >> Am Thu, 19 Nov 2009 00:38:01 -0800 schrieb Old Man River:
> >
> >>> Thank you for your patience Michael.
> >>
> >>> Firstly I can assure you that the code is in ThisOutlookSession. the

> title
> >>> of the window is "Microsoft Visual Basic - VbaProject -
> >> [ThisOutlookSession
> >>> (Code)]".
> >>
> >>> So I just tried your suggestions viz:
> >>> 1. set Macro security to run all macros then
> >>> 2. removed the certificate.
> >>
> >>> After both steps I restarted Outlook to no avail. (The Stop remains
> >>> commented out.)
> >>> The only difference was that I was not prompted to safeve the VBA

> Project
> >>> when I closed Outlook
> >>
> >>> I have sent a support request to MS.
> >>
> >>> Many Thanks - Alan
> >>
> >>> "Michael Bauer " wrote:
> >>
> >>>
> >>>> 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
> >>>
> >>>> > >>>> > >>>>

> >>>
> >>>
> >>>
> >>>> 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 " wrote:
> >>>>
> >>>>>
> >>>>>
> >>>>>> Have you tried it without calling Stop?
> >>>>>
> >>>>>> > >>>>>> Best regards
> >>>>>> Michael Bauer
> >>>>>
> >>>>>> > >>>>>> > >>>>>>

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

> >>>>>>>
> >>>>>>>
> >>>>>>>> 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?
> >>>>>>>> .
> >>>>>>>
> >>>>>> .
> >>>>>
> >>>> .
> >>>
> >> .
> >>

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I wonder if you had accidentally created too many of your button. Although

the Commandbar has been improved, since Office 2000 it is a good idea to

create commandbars and -buttons temporily only.

Best regards

Michael Bauer

Am Tue, 24 Nov 2009 02:19:01 -0800 schrieb Old Man River:


> On checking I found that the bad Outcmd.dat file had grown to a massive
> 233,550KB, the new one is only 3KB.

> I got some further info from MS. Viz:

> "Apparently when we write the outcmd.dat file and VBA is loaded, we check


if
> there are any Application level events, and if there are, then we set a


bit
> that tells us to load VBA on boot. So if the outcmd.dat file is not


present
> or if the bit is not set properly, VBA will not load on boot.

> If you want your macro to always be loaded, you could also try to set the
> value of the LoadBehavior key to 3. The key is located under

>


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins\NameOfTheAdd-In

> By default, the value is 9, but if you set it to 3, you will always load


the
> macro and overwrite the default security settings for the respective


add-in.

> See also http://msdn.microsoft.com/en-us/library/19dax6cz(VS.80).aspx"
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
bmtjedi Set objApp = Application Not Working in O365-32bit Using Outlook 1
avant-guvnor Outlook.Application now produces error Outlook VBA and Custom Forms 5
C Custom Application Form send Email to Another User Using Outlook 1
N Select Existing BCM Business Contact in C# application Using Outlook 0
S Using "start application" rule action Using Outlook 2
smokiibear windows security mail application not accepting username and password Using Outlook 0
Y VBA - Application Filedialog Hidden Behind Outlook Using Outlook 0
T Synchronize outlook appointments through web application. Using Outlook 1
O Outlook 2010 Stops Working When Accounting Application Tries To Send eMail Using Outlook 4
C MAPI to access a 64 bit Outlook from a 32 bit application; or access via ODBC Using Outlook 0
J Delays when changing from one application to another in Outlook Using Outlook 2
T How can I send e-mail from an Access 2010 application using Outlook not CDO Using Outlook 1
P All of a sudden I cannot open the INBOX file. It asks me to close any application and restart. Done that several times. Nothing Using Outlook 1
M Determine if a public Folder is used by an Application Using Outlook 2
U How do I copy my address book in a vcard application? Using Outlook 1
M Server Error in '/FacilityService' Application. Exchange Server Administration 3
B Identify SMTP email submitted from IP or Application for rule creation? Exchange Server Administration 7
S incompatible application cannot open hyperlinks in email messages__ Using Outlook 2
B OUTLOOK 2010 Set up wrong and now can't open application to fix it... Using Outlook 1
H Importing Unread emails to a 3rd party Application - Civica Using Outlook 1
K Outlook 2007 - error opening the application Using Outlook 1
B Microsoft Visual C++ Runtime Library message, "This application has requested the Runtime to termina Using Outlook 1
A Access 64 bit Outlook 2010 from 32 bit C++ application Using Outlook 1
N Business Application for Master Category List in 2010 Outlook's Business Contact Manager Using Outlook 1
D An error in the transmission of the command to the application Using Outlook 1
U Outlook 2003- Incompatible Application - Using Outlook 1
S Error 'outlook cannot launch an application to handle d:\xxxxxx' when try to insert file. Using Outlook 1
R New Relay for an application server to send bulk mail Exchange Server Administration 2
T Use edge servers as relay machines for application servers Exchange Server Administration 2
D The attachment filename.xls is open or in use by another application. Using Outlook 11
K Cannot start Microsoft Outlook. Cannot open the Outlook Window. Incompatible application Using Outlook 1
H Application stops running while I'm typing an email! Using Outlook 2
W 'Windows Application Error 0Xc00000a5” error opening attached files or email link in Outlook Using Outlook 1
P error message oxc00000a5 unable to open application. Using Outlook 1
F Need to fill an application and mail it. Using Outlook 1
M On exiting Outlook 7 the application recovers and restarts Using Outlook 2
7 Faulting application outlook.exe, Stamp 4bf5c678 Using Outlook 6
J Exchange 2010 Application error Exchange Server Administration 5
T outlook\outlook.pst\ is in use and could not be accessed. Close any application that is using this f Using Outlook 6
R Exchange 2010 setup failed: The application has failed to start because its side-by-side configuration is incorrect. 0x800736B1 Exchange Server Administration 3
K Handling application.quit event Outlook VBA and Custom Forms 8
H "Configuration section not allowed to be set below application" error when Authentication selected i Exchange Server Administration 5
A turn Outlook into a Drag-and-drop application Outlook Wishlist 2
M VSTO C#: How do I declare an application scope variable? Outlook VBA and Custom Forms 2
E Turn application visibility off Outlook VBA and Custom Forms 2
T Run application from cmd button Outlook VBA and Custom Forms 5
D Outlook 2007 Will Not Send Mail From C# Application Outlook VBA and Custom Forms 7
P Supporting threads in Outlook VBA application Outlook VBA and Custom Forms 1
R vba instantiated internetExplorer.application differs from user la Outlook VBA and Custom Forms 1
K How to disconnect Application.COMAddIns.Item().Object? Outlook VBA and Custom Forms 4
Similar threads


















































Top