View Single Post
  #7  
Old March 6th 06, 06:58 PM posted to microsoft.public.outlook.program_addins
Dave Kane [MVP - Outlook]
external usenet poster
 
Posts: 33
Default Strange Outlook Add-In problems

It is more efficient to declare the namespace variable once at a module or
global level and keep a reference to it, but how you handle that is not
going to affect whether or not your add-in gets disabled.

"Christoph" wrote in message
ups.com...
I think I have solved one thing causing the error.

In many functions I'm getting different folders.
For Example:
...
'DB.OlApp is a global Object, I'm setting at On_Connection.
...

Dim oNameSpace As outlook.NameSpace
Dim oPersFolder As outlook.MAPIFolder

Set oNameSpace = DB.OlApp.GetNamespace("MAPI")
Set oPersFolder = oNameSpace.GetDefaultFolder(olFolderContacts).Pare nt
...
Set oPersFolder = Nothing
Set oNameSpace = Nothing


Now I'm getting my folders without an own namespace variable

Dim oPersFolder As outlook.MAPIFolder

Set oPersFolder =
DB.OlApp.GetNamespace("MAPI").GetDefaultFolder(olF olderContacts).Parent
...
Set oPersFolder = Nothing

So I think the Script Stopper problem has also something to do with the
namespace object, not only with the application object.


Would it be a problem to do the same with the namespace object as I'm
doing it with the application object?
At On_Connection I'm setting a global namespace variable.
Then I'm always using the same global namespace object.

Like...

DB.olNameSpace would then be the global namespace object.
And I'm always using that object.

Dim oPersFolder As outlook.MAPIFolder
Set oPersFolder =
DB.olNameSpace.GetDefaultFolder(olFolderContacts). Parent

Is this the best solution or should I leave it like that?
Set oPersFolder =
DB.OlApp.GetNamespace("MAPI").GetDefaultFolder(olF olderContacts).Parent



Ads