wingmanshaks
asked on
Creating a MS Outlook 2010 mail message from Powerbuilder only works when Outlook is closed
Hi
I am using Powerbuilder 11.5 and have updated the code to handle MS Outlook 2010.
The code used to work fine with earlier versions of Outlook and allowed the user to send emails from Powerbuilder with either Outlook running or not running, but does not work now since the Outlook version change when Outlook is running. The code works fine when Outlook is not running.
updated version not working when Outlook open
HKEY_LOCAL_MACHINE\Softwar e\Microsof t\Office\1 4.0\Outloo k\InstallR oot
previous working version of Outlook
HKEY_LOCAL_MACHINE\Softwar e\Microsof t\Office\1 0.0\Outloo k\InstallR oot
The code is as follows;
The code fails on the above line (CreateItem) when MSOutlook is running
This works fine when MSOutlook is closed - the mail is generated and sent
I cannot find what is needed to allow a new mail to be generated when MS Outlook is open - I would be really grateful for any assistance - thanks Wingmanshaks
I am using Powerbuilder 11.5 and have updated the code to handle MS Outlook 2010.
The code used to work fine with earlier versions of Outlook and allowed the user to send emails from Powerbuilder with either Outlook running or not running, but does not work now since the Outlook version change when Outlook is running. The code works fine when Outlook is not running.
updated version not working when Outlook open
HKEY_LOCAL_MACHINE\Softwar
previous working version of Outlook
HKEY_LOCAL_MACHINE\Softwar
The code is as follows;
//Declaration
OLEObject myoleobject, db, doc, rt_item, loo_ol_msg_cast
myoleobject = CREATE OLEObject
// loop for two minutes, or until notes is started successfully
t_StartTime=Now() //wait 2 min for Notes to load ...
Do
Yield() //yeld control occasionally
SetPointer(hourglass!)
iResult = myoleobject.ConnectToNewObject("outlook.application")
If iResult = 0 Then Exit //OK, Outlook is active
Yield()
Loop Until SecondsAfter(t_Starttime, now()) > 120 //try again in #sec
if iResult <> 0 then
f_user_error("Could not open Microsoft Outlook")
return FALSE
end if
loo_ol_msg_cast = myoleobject.CreateItem(0)
The code fails on the above line (CreateItem) when MSOutlook is running
This works fine when MSOutlook is closed - the mail is generated and sent
I cannot find what is needed to allow a new mail to be generated when MS Outlook is open - I would be really grateful for any assistance - thanks Wingmanshaks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just checking if that previous answer was helpful or not?
Use the following if Outlook is not running.
myoleobject.ConnectToNewOb ject("outl ook.applic ation")
If Outlook is already running, use
myoleobject.ConnectToObjec t("outlook .applicati on")
Normally, check if Outlook is running first using ConnectToObject("outlook.a pplication "), if not, use ConnectToNewObject("outloo k.applicat ion") to start it.
myoleobject.ConnectToNewOb
If Outlook is already running, use
myoleobject.ConnectToObjec
Normally, check if Outlook is running first using ConnectToObject("outlook.a