Sign in to follow this  
Followers 0

OutlookEX UDF - Help & Support

635 posts in this topic

#1 ·  Posted (edited)

This is the "General Help and Support" thread for the Extended Outlook UDF (OutlookEX).

The UDF itself can be downloaded here (please see my signature below).

So if you have any questions, suggestions or errors please post here.

Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi Water,

I am trying to send an email to particular ID by using "Outlook.au3" - _outlooksendemail() function. But i am ending up with an error message Error occured during the "Objevent". The error value returns as "9". Do you have any suggestion for me please ?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Syed,

Did you call _OutlookOpen() as first statement?

Is Outlook installed on the machine?

Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#4 ·  Posted

Hi Syed,

Did you call _OutlookOpen() as first statement?

Is Outlook installed on the machine?

yeah.. I do water. Please see the below code! Also Outlook is present on that machine, Office 2007.

#include<Outlook.au3>

#include<File.au3>

$ooutlook = _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt,"Tahoma")

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Please replace the last parameter of _OutlookSendMail. "Tahoma" is no an valid entry.

You can just use $olFormatHTML, $olFormatPlain, $olFormatRichText, $olFormatUnspecified to specify the format of the body.

Edit:

Or if you like you can use OutlookEX, the successor of the Outlook UDF.

OutlookEX has more functions, better error handling ...

We have even written "wrapper" functions so migration from Outlook to OutlookEX is much easier.

If you like I can post the code.

Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#6 ·  Posted

Please replace the last parameter of _OutlookSendMail. "Tahoma" is no an valid entry.

You can just use $olFormatHTML, $olFormatPlain, $olFormatRichText, $olFormatUnspecified to specify the format of the body.

even i tried with the below code! still the result same! :)

#include<Outlook.au3>

#include<File.au3>

$ooutlook = _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt)

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Isn't there a typo in "$attachemnt"? Shouldn't it read "$attachment"?

BTW: There is an enhanced Outlook UDF available - please see my previous post.

Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#8 ·  Posted

Isn't there a type in "$attachemnt"? Shouldn't it read "$attachment"?

BTW: There is an enhanced Outlook UDF available - please see my previous post.

for the varible $attachemnt i have declared properly. Please see the below 2 two options what i have tried. But the result where same :). sorry for this late reply

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()

; *****************************************************************************

; Example 1

; Send an html mail to the current user.

; Add an attachment and set importance to high.

; *****************************************************************************

Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name

_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)

If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)

MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

; *****************************************************************************

; Example 2

; *****************************************************************************

#include<Outlook.au3>

#include<File.au3>

$attachemnt = "C:\temp\report.html"

$TextBody = "does it works without any issue?"

$oOutlook= _OutlookOpen()

_OutlookSendMail($oOutlook, "winningmoment_syed@yahoo.co.in","","", "GD Core Application Checker tool Feedback", $TextBody,$attachemnt)

If @error Then

_FileWriteLog(@DesktopDir&"\outlook.log","Error > Mail Process >"&"Uanble to send an email.Error occured during the mail process.Error value is "&@error)

MsgBox(64,"Error Message","Error Occured while sending an email")

EndIf


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#9 ·  Posted

Could you please run the following script? I inserted one line (denoted by <==) which should give us better error messages. Could you please post the pop up you get?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
$iOL_Debug = 2  ; <== Insert this line
; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#10 ·  Posted

Could you please run the following script? I inserted one line (denoted by <==) which should give us better error messages. Could you please post the pop up you get?

#include <OutlookEX.au3>

Global $oOutlook = _OL_Open()
$iOL_Debug = 2     ; <== Insert this line
; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

yeah..i gave a try and got below message!

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#11 ·  Posted

Mmmm ... "operation aborted" can be everything.

What operating system do you run?

What version of Outlook do you use?


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Scriptline 10 seems to be the line before _OL_MailSend.

Could you please run this - modified - version? We try to catch the error as soon as possible.

#include <OutlookEX.au3>
$iOL_Debug = 2  ; <==This line has been moved
Global $oOutlook = _OL_Open()

; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")
Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Scriptline 10 seems to be the line before _OL_MailSend.

Could you please run this - modified - version? We try to catch the error as soon as possible.

#include <OutlookEX.au3>
$iOL_Debug = 2     ; <==This line has been moved
Global $oOutlook = _OL_Open()

; *****************************************************************************
; Example 1
; Send an html mail to the current user.
; Add an attachment and set importance to high.
; *****************************************************************************
Global $sCurrentUser = $oOutlook.GetNameSpace("MAPI").CurrentUser.Name
_OL_MailSend($oOutlook, "TestSubject", "Body<br><b>fett</b> normal.", $sCurrentUser, @ScriptDir & "\_OL_MailSend.au3", $olImportanceHigh, $olFormatHTML)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_MailSend Example Script", "Error sending mail. @error = " & @error & ", @extended: " & @extended)
MsgBox(64, "OutlookEX UDF: _OL_MailSend Example Script", "Mail successfully sent to user '" & $sCurrentUser & "'!")

The modified script works fine only if i have opened the outlook during the script execution orelse the below messages are getting prompted.please let me know if i follow anything wrong. Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#14 ·  Posted

Same problem here. It runs fine when Outlook is running. But crashes with the same error messages you get if Outlook is not up and running.

I'll have to investigate this problem.


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#15 ·  Posted

Hi Syed,

I've been searching the internet high and low but couldn't find a solution.

It seems as if ObjCreate starts up Outlook and returns to your script before the COM interface is up and running. It looks as if Outlook does some of the startup asynchroniously.

The only solution I have so far is to put a Sleep(1000) - or more - after _OL_Open().


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#16 ·  Posted

Hi Syed,

I've been searching the internet high and low but couldn't find a solution.

It seems as if ObjCreate starts up Outlook and returns to your script before the COM interface is up and running. It looks as if Outlook does some of the startup asynchroniously.

The only solution I have so far is to put a Sleep(1000) - or more - after _OL_Open().

hmmm... Thanks for your research on it Water.Currently i am vaccation.Once i get in to work i will test it and let you know the solution.

Note:

On Windows machine i am getting the same error message even if i have opened the outlook during the script execution. Shall i try the same solution on Windows 7 too ?

Anyway Thanks a lot and i will let you know the results!


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Hi Syed,

I've tested on Windows XP SP3 with Outlook 2002 and on Windows 7 SP1 with Outlook 2010.

On both machines Windows 7 with Outlook 2010 it works when Outlook is already running and doesn't if I don't wait for Outlook to come up.

Edit:

On Windows XP SP3 with Outlook 2002 it doesn't matter if Outlook is running or not - _OL_MailSend always works.

Edited by water

My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#18 ·  Posted

Version 0.0.3 has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites

#19 ·  Posted

Seems to work well however if I loop the ItemFind function I get this if I don't put timed delay between the commands:

OutlookEX.au3 (1831) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$aOL_Items[$iOL_Counter][$iOL_Index - 1] = $oOL_Item.ItemProperties.Item($aOL_ReturnProperties[$iOL_Index] ).value

^ ERROR

Works fine if I pause for a couple of seconds after each call.

Any ideas? Since I don't directly see a flaw in your code to cause it.

Share this post


Link to post
Share on other sites

#20 ·  Posted

Hi Autobot,

put a Sleep for a few seconds (>10) after _OL_Open and see if the problem persists.

In addition you can set $iOL_Debug = 2 before _OL_Open.

If you get 0x80004004 (Operation aborted) you have the same problem we are investigating at the moment.

What Windows do you run, what Outllok do you run?


My UDFs and Tutorials:

UDFs:
Active Directory (NEW 2015-08-07 - Version 1.2.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (NEW 2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this  
Followers 0