Welcome! Log In Create A New Profile

Advanced

AUTOMATIC OLE OBJECT OUTLOOK

Posted by Marc De Swert 
Marc De Swert
AUTOMATIC OLE OBJECT OUTLOOK
May 02, 2022 10:58PM
HI guys,

a little problem

i have in Windev 18 a automatic program that makes an backup from de datafiles and send it to me and the user
normaly this wil be done every day

i created it in windev 18 (yep, old school)

when i run it by clicking the exe himself there is no probem, it's works ine

but i want to do the job thru the taskplanner of windows 10

i create an task for it

it starts but give an error like this:

What happened?
Automation object ('Outlook.Application') not installed on your system.
Error code: 2202
Level: fatal error (EL_FATAL)


in my code i use then following:

myItem is object OLE dynamic
myOlApp is object OLE dynamic
myOlApp= new object OLE "Outlook.Application"


here i create the zip file and then the email section

sMailSUBJECT = "DAILY BACKUP DATA " + DateToString(Today(), "DD-MM-YYYY")
sMailBODY = "Backup Creatie"
IF gsMailZipToM <> "" THEN
myItem = myOlApp>>CreateItem(0)
myItem>>Recipients>>Add(gsMailZipToM)
myItem>>Recipients>>Add(gsMailZipToD)
myItem>>Subject = sMailSUBJECT
myItem>>Body = sMailBODY
myItem>>Attachments>>Add(sPsArchiveFile)
myItem>>send()
// IF ErrorOccurred THEN Error(ErrorInfo(errSummary))
END

so when i run it manually there is no problem
on the pc s windows 18 and Microsoft Office Professional Plus 2019 installed

can sombody help me what to do? some extra install form something?

greetings and thanks
Argus
Re: AUTOMATIC OLE OBJECT OUTLOOK
May 03, 2022 07:05AM
Don't worry, you have the VERY USUAL permissions problem in that case...

Your task is ran by a system user with limited rights by defaults (and certainly not the right to create OLE automation objects)...

So, when you set the task to run, you should see somewhere an option that allows you to run it -AS- and there, you put your usual login/password.

this way it will run with your usual permissions...

Of course, you can also create a user just for that... just make sure that if you log at the new user, your program runs well.
Re: AUTOMATIC OLE OBJECT OUTLOOK
May 03, 2022 08:50AM
Hi

OLE is indeed pretty old school...
Aside of the comments on the rights (which is the first thing I would look at too), I think it can be a 32-bit/64-bit issue as well.
E.g. your program is 32-bit but Outlook (Office) is installed in 64-bit.

Not sure but I believe the OLE consumer and provider need to be on the same level.

If this is the case tweaking the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{OFFICE GUID KEY}\VERSION\SUB\Win64
copying it to:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{OFFICE GUID KEY}\VERSION\SUB\Win32
may be a workaround but that is undocumented/untested from my end.
Otherwise create a dual 32/64-bit version of your program.

Cheers

Peter H.



Edited 1 time(s). Last edit at 05/03/2022 08:51AM by PeHoBe.
Marc De Swert
Re: AUTOMATIC OLE OBJECT OUTLOOK
May 03, 2022 10:25AM
thxs all to you

i will try this

seems to be te problem of rights

and yes, old school works fine for wat we need
mayby in windev 18 there is a better way?

Marc
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: