WithEvents-Problem in compiled Com-Add-In

P

Peter Marchert

Hello,

the following code works in the VBA-Editor of Outlook:

Option Explicit
Private WithEvents colInsp As Outlook.Inspectors
Private WithEvents objInsp As Outlook.Inspector

Private Sub Class_Initialize()
Set colInsp = Outlook.Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
Set objInsp = Inspector
MsgBox objInsp, vbInformation
End Sub

If I create with this code an Com-Add-In it occurs on the line "Set
objInsp = Inspector" this error: "Run-time-error 459 - Object or class
does not support the set of events".

I`m developing the Add-Ins with the developer Office XP and Outlook
2003. The same code works on Outlook-Versions from 2002 or higher. The
error only occurs on Outlook 2000. So I think it has something to do
with "binding"? But I don`t know anything about this :-(

Since a few days I have access to the msdn-library where a "Visual
Studio 2005 Pro" and a "Visual Studio Tools for Office System" is
included. Now my questions are:
1. Can I develop with this software Com-Add-Ins for Outlook 2000-2007?
2. Have I to migrate the VBA-Code to C++ or can I still use my existing
code with some modifications?

Thanks for any help!

Gruß
Peter
 
K

Ken Slovak - [MVP - Outlook]

If you want to compile for Outlook 2000 you must use and reference the
Outlook 2000 object library. It won't work if you try using an Outlook 2002
reference for your project.

VSTO only supports Outlook 2003 Professional or above and Outlook 2007 (all
SKU's) if you are using VSTO 2005 SE. You can't develop for other versions
of Outlook 2003 or earlier versions of Outlook.

There is no Outlook 2000 PIA, you have to hand modify the Outlook 2002 PIA
and use that if you want to use .NET code. There are instructions about
modifying the Outlook 2002 PIA for use with Outlook 2000 at
http://www.microeye.com/resources/res_outlookvsnet.htm.




Hello,

the following code works in the VBA-Editor of Outlook:

Option Explicit
Private WithEvents colInsp As Outlook.Inspectors
Private WithEvents objInsp As Outlook.Inspector

Private Sub Class_Initialize()
Set colInsp = Outlook.Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
Set objInsp = Inspector
MsgBox objInsp, vbInformation
End Sub

If I create with this code an Com-Add-In it occurs on the line "Set
objInsp = Inspector" this error: "Run-time-error 459 - Object or class
does not support the set of events".

I`m developing the Add-Ins with the developer Office XP and Outlook
2003. The same code works on Outlook-Versions from 2002 or higher. The
error only occurs on Outlook 2000. So I think it has something to do
with "binding"? But I don`t know anything about this :-(

Since a few days I have access to the msdn-library where a "Visual
Studio 2005 Pro" and a "Visual Studio Tools for Office System" is
included. Now my questions are:
1. Can I develop with this software Com-Add-Ins for Outlook 2000-2007?
2. Have I to migrate the VBA-Code to C++ or can I still use my existing
code with some modifications?

Thanks for any help!

Gruß
Peter
 
P

Peter Marchert

Hello Ken,

thanks for your answer.

I visited the link but this is all new for me and I could not
understand all (my english is not the best).

The rest of my code with some used events (for example
"CommandBars_OnUpdate" or Button_Click) works with 2000 without
problems. Only the Inspector-Collection makes troubles.

However, I think at this time I will drop a function for 2000 and
inform me a little bit more what I should do. I think I should use
..net-code, isn`t it?

Peter
If you want to compile for Outlook 2000 you must use and reference the
Outlook 2000 object library. It won't work if you try using an Outlook 2002
reference for your project.

VSTO only supports Outlook 2003 Professional or above and Outlook 2007 (all
SKU's) if you are using VSTO 2005 SE. You can't develop for other versions
of Outlook 2003 or earlier versions of Outlook.

There is no Outlook 2000 PIA, you have to hand modify the Outlook 2002 PIA
and use that if you want to use .NET code. There are instructions about
modifying the Outlook 2002 PIA for use with Outlook 2000 at
http://www.microeye.com/resources/res_outlookvsnet.htm.




Hello,

the following code works in the VBA-Editor of Outlook:

Option Explicit
Private WithEvents colInsp As Outlook.Inspectors
Private WithEvents objInsp As Outlook.Inspector

Private Sub Class_Initialize()
Set colInsp = Outlook.Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
Set objInsp = Inspector
MsgBox objInsp, vbInformation
End Sub

If I create with this code an Com-Add-In it occurs on the line "Set
objInsp = Inspector" this error: "Run-time-error 459 - Object or class
does not support the set of events".

I`m developing the Add-Ins with the developer Office XP and Outlook
2003. The same code works on Outlook-Versions from 2002 or higher. The
error only occurs on Outlook 2000. So I think it has something to do
with "binding"? But I don`t know anything about this :-(

Since a few days I have access to the msdn-library where a "Visual
Studio 2005 Pro" and a "Visual Studio Tools for Office System" is
included. Now my questions are:
1. Can I develop with this software Com-Add-Ins for Outlook 2000-2007?
2. Have I to migrate the VBA-Code to C++ or can I still use my existing
code with some modifications?

Thanks for any help!

Gruß
Peter

--
Peter Marchert
[EDV-Service Marchert]
Homepage: http://www.marchert.de
Excel- und Outlookprogrammierung
 
K

Ken Slovak - [MVP - Outlook]

Whether or not you use .NET code is up to you. I do all my production addins
using VB 6, it's faster and I don't have the problems of shared addins
needing shimming, the late binding problems of all Outlook and Office
objects and various other things.

I'd say as my own opinion that unless a client insists on .NET code or you
only plan to support Outlook 2003 and later that using .NET code doesn't
bring much in the way of advantages, if any.




Hello Ken,

thanks for your answer.

I visited the link but this is all new for me and I could not
understand all (my english is not the best).

The rest of my code with some used events (for example
"CommandBars_OnUpdate" or Button_Click) works with 2000 without
problems. Only the Inspector-Collection makes troubles.

However, I think at this time I will drop a function for 2000 and
inform me a little bit more what I should do. I think I should use
..net-code, isn`t it?

Peter
If you want to compile for Outlook 2000 you must use and reference the
Outlook 2000 object library. It won't work if you try using an Outlook
2002
reference for your project.

VSTO only supports Outlook 2003 Professional or above and Outlook 2007
(all
SKU's) if you are using VSTO 2005 SE. You can't develop for other versions
of Outlook 2003 or earlier versions of Outlook.

There is no Outlook 2000 PIA, you have to hand modify the Outlook 2002 PIA
and use that if you want to use .NET code. There are instructions about
modifying the Outlook 2002 PIA for use with Outlook 2000 at
http://www.microeye.com/resources/res_outlookvsnet.htm.




Hello,

the following code works in the VBA-Editor of Outlook:

Option Explicit
Private WithEvents colInsp As Outlook.Inspectors
Private WithEvents objInsp As Outlook.Inspector

Private Sub Class_Initialize()
Set colInsp = Outlook.Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
Set objInsp = Inspector
MsgBox objInsp, vbInformation
End Sub

If I create with this code an Com-Add-In it occurs on the line "Set
objInsp = Inspector" this error: "Run-time-error 459 - Object or class
does not support the set of events".

I`m developing the Add-Ins with the developer Office XP and Outlook
2003. The same code works on Outlook-Versions from 2002 or higher. The
error only occurs on Outlook 2000. So I think it has something to do
with "binding"? But I don`t know anything about this :-(

Since a few days I have access to the msdn-library where a "Visual
Studio 2005 Pro" and a "Visual Studio Tools for Office System" is
included. Now my questions are:
1. Can I develop with this software Com-Add-Ins for Outlook 2000-2007?
2. Have I to migrate the VBA-Code to C++ or can I still use my existing
code with some modifications?

Thanks for any help!

Gruß
Peter

--
Peter Marchert
[EDV-Service Marchert]
Homepage: http://www.marchert.de
Excel- und Outlookprogrammierung
 
P

Peter Marchert

Hmm, if you use VB6 I think I should it do too :)

VB is similar to VBA so it should not be a great problem to fit my
existing code to this developing software.

Thank you very much for that informations, Ken.

Peter
Whether or not you use .NET code is up to you. I do all my production addins
using VB 6, it's faster and I don't have the problems of shared addins
needing shimming, the late binding problems of all Outlook and Office
objects and various other things.

I'd say as my own opinion that unless a client insists on .NET code or you
only plan to support Outlook 2003 and later that using .NET code doesn't
bring much in the way of advantages, if any.




Hello Ken,

thanks for your answer.

I visited the link but this is all new for me and I could not
understand all (my english is not the best).

The rest of my code with some used events (for example
"CommandBars_OnUpdate" or Button_Click) works with 2000 without
problems. Only the Inspector-Collection makes troubles.

However, I think at this time I will drop a function for 2000 and
inform me a little bit more what I should do. I think I should use
.net-code, isn`t it?

Peter
If you want to compile for Outlook 2000 you must use and reference the
Outlook 2000 object library. It won't work if you try using an Outlook
2002
reference for your project.

VSTO only supports Outlook 2003 Professional or above and Outlook 2007
(all
SKU's) if you are using VSTO 2005 SE. You can't develop for other versions
of Outlook 2003 or earlier versions of Outlook.

There is no Outlook 2000 PIA, you have to hand modify the Outlook 2002 PIA
and use that if you want to use .NET code. There are instructions about
modifying the Outlook 2002 PIA for use with Outlook 2000 at
http://www.microeye.com/resources/res_outlookvsnet.htm.




Hello,

the following code works in the VBA-Editor of Outlook:

Option Explicit
Private WithEvents colInsp As Outlook.Inspectors
Private WithEvents objInsp As Outlook.Inspector

Private Sub Class_Initialize()
Set colInsp = Outlook.Application.Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
Set objInsp = Inspector
MsgBox objInsp, vbInformation
End Sub

If I create with this code an Com-Add-In it occurs on the line "Set
objInsp = Inspector" this error: "Run-time-error 459 - Object or class
does not support the set of events".

I`m developing the Add-Ins with the developer Office XP and Outlook
2003. The same code works on Outlook-Versions from 2002 or higher. The
error only occurs on Outlook 2000. So I think it has something to do
with "binding"? But I don`t know anything about this :-(

Since a few days I have access to the msdn-library where a "Visual
Studio 2005 Pro" and a "Visual Studio Tools for Office System" is
included. Now my questions are:
1. Can I develop with this software Com-Add-Ins for Outlook 2000-2007?
2. Have I to migrate the VBA-Code to C++ or can I still use my existing
code with some modifications?

Thanks for any help!

Gruß
Peter

--
Peter Marchert
[EDV-Service Marchert]
Homepage: http://www.marchert.de
Excel- und Outlookprogrammierung
 
K

Ken Slovak - [MVP - Outlook]

Use VB 6 if it's best for you, not because I do :)




Hmm, if you use VB6 I think I should it do too :)

VB is similar to VBA so it should not be a great problem to fit my
existing code to this developing software.

Thank you very much for that informations, Ken.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top