Jump to content
Sign in to follow this  
ibigpapa

outlook.application

Recommended Posts

ibigpapa

when i use the outlook object in vb to create an email it works great.

well now i'm moving my vb script into auto it.

Here is the vb snippet

Set OutlookApp = createobject("Outlook.Application")
Set OutlookMailItem = OutlookApp.CreateItem(olMailItem)

so in auto it i do

$outlookApp = objcreate("outlook.application")
$outlookMailItem = $outlookApp.createitem(olmailitem)

autoit barfs at the create item on the second line.

I'm probably calling it incorrectly. Any help would be great.

Share this post


Link to post
Share on other sites
Authenticity

olMailItem is a constant and it's value is 0 (zero). Either define the constants as you usually define constants with it's descriptive variable name or use the constant values directly in the call:

Const olMailItem = 0
Const olAppointmentItem = 1
Const olContactItem = 2
Const olTaskItem = 3
Const olJournalItem = 4
Const olNoteItem = 5
Const olPostItem = 6
Const olDistributionListItem = 7

So in AutoIt it should be:

Global Const $olMailItem = 0
Global Const $olAppointmentItem = 1
Global Const $olContactItem = 2
Global Const $olTaskItem = 3
Global Const $olJournalItem = 4
Global Const $olNoteItem = 5
Global Const $olPostItem = 6
Global Const $olDistributionListItem = 7

Global $outlookApp = objcreate("outlook.application")
Global $outlookMailItem = $outlookApp.createitem($olMailItem) ; Or 0.

Share this post


Link to post
Share on other sites
ibigpapa

THANKS!!! that's it.

olMailItem is a constant and it's value is 0 (zero). Either define the constants as you usually define constants with it's descriptive variable name or use the constant values directly in the call:

Const olMailItem = 0
Const olAppointmentItem = 1
Const olContactItem = 2
Const olTaskItem = 3
Const olJournalItem = 4
Const olNoteItem = 5
Const olPostItem = 6
Const olDistributionListItem = 7

So in AutoIt it should be:

Global Const $olMailItem = 0
Global Const $olAppointmentItem = 1
Global Const $olContactItem = 2
Global Const $olTaskItem = 3
Global Const $olJournalItem = 4
Global Const $olNoteItem = 5
Global Const $olPostItem = 6
Global Const $olDistributionListItem = 7

Global $outlookApp = objcreate("outlook.application")
Global $outlookMailItem = $outlookApp.createitem($olMailItem) ; Or 0.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×