i have been tasked with automating a simple create email task using microsoft outlook.
the code below works create unfortunately it works only at a system level i.e. the user does not see it.
please help me make it visible
Expand|Select|Wrap|Line Numbers
- text="hello wolrd \nhello world this is hopefully a new paragrpah"
- subject="this is the E-mail"
- recipient="thingy-ma-bob@hotmail.com"
- o = win32com.client.DispatchEx("Outlook.Application.11")
- #o.Show() #<--here
- Msg = o.CreateItem(0)
- Msg.To = recipient
- Msg.Subject = subject
- Msg.Body = text
- Msg.Save()
- Msg.close
- o.Quit()
o.Visible throws a com error (AttributeError: Outlook.Application.Visible)
o.Display throws a com error (AttributeError: Outlook.Application.Display)
both the above set to true gain throws a com error
o.Show (AttributeError: Outlook.Application.Show)
all of the above with and without attributes
If i set o.Visible =1 (i.e. True)I get the com error
AttributeError: Property 'Outlook.Application.Visible' can not be set.
it must be possible as all other office products you can set to be visible.
obviusly I can
Expand|Select|Wrap|Line Numbers
- os.system("start outlook")
but that is just nasty....
I might as well be using a Key pressing program and not bother with com
Please help
cheers
D2