Tom Borgmann
Programmer
Hi guys,
currently VFP reacts different with identical code, depending on placing it in a prg or within a class method.
the prg version runs fine and in a split second it opens the outlook mail window, either if Outlook is running or not.
However, the same code within a class fires error 1426
I also changed the code from LOCAL to class properties and even PUBLIC, but from within the classlib it always comes up with 1426 when trying to instanciate Outlook. I also switched from CREATEOBJECT to CREATEOBJECTEX, but to no avail. I should mention, that CREATEOBJECTEX within the prg is working fine, too.
Anything about that error I found on the web was based on patching problems. But this isn't the case here because I'm testing both version at the time.
Here comes the code snippet and hopefully someone can give me a hint on this.
TIA
-Tom
currently VFP reacts different with identical code, depending on placing it in a prg or within a class method.
the prg version runs fine and in a split second it opens the outlook mail window, either if Outlook is running or not.
However, the same code within a class fires error 1426
I also changed the code from LOCAL to class properties and even PUBLIC, but from within the classlib it always comes up with 1426 when trying to instanciate Outlook. I also switched from CREATEOBJECT to CREATEOBJECTEX, but to no avail. I should mention, that CREATEOBJECTEX within the prg is working fine, too.
Anything about that error I found on the web was based on patching problems. But this isn't the case here because I'm testing both version at the time.
Here comes the code snippet and hopefully someone can give me a hint on this.
TIA
Code:
TRY
LOCAL loOutlook AS Outlook.Application
LOCAL loNameSpace AS Outlook.NameSpace
LOCAL loMailItem AS Outlook.MailItem
#DEFINE olMailItem 0
* // This is where the error fires!!!!!!
* // It lasts ~15-30 secs, until the app falls into the CATCH TO blog
* loOutlook = CREATEOBJECT( [Outlook.Application] )
loOutlook = CREATEOBJECTEX( [Outlook.Application] , [] , [] )
loNameSpace = loOutlook.GetNamespace( [MAPI] )
loNameSpace.Logon
loMailItem = loOutlook.CreateItem( olMailItem )
WITH loMailItem
.Recipients.Add( [EMAIL@YOU.NET] )
.Subject = [place some text here]
.Body = [place some messagetext there]
.Display
ENDWITH
loMailItem = .NULL.
loNameSpace = .NULL.
loOutlook = .NULL.
CATCH TO ex
SET STEP ON
llOK = .F.
ENDTRY
-Tom