T
texasHawkeye
I am trying to send an email using Word using OLE controls. I would like to
duplicate File -> Send To -> Mail Recipient. Macros have not been helpful as
I am not sure if Word is using an Outlook add-in to do the dirty work behind
the scenes.
Here is some of what I have tried so far...
1)
ole_doc = CREATE oleobject
ole_olk = CREATE oleobject
ole_msg = CREATE oleobject
ls_filename = "C:\test.htm"
ole_doc.ConnectToNewObject("word.application")
ole_doc.visible = true
ole_doc.Documents.Open(ls_filename)
ole_olk.ConnectToNewObject("Outlook.application")
ole_msg = ole_olk.createItem(0)
ole_msg.to = '(e-mail address removed)'
ole_msg.subject = 'Testing subj.'
ole_msg.BodyFormat = 2 //HTML
ole_msg.HTMLBody = ole_doc.ActiveDocument.Content
ole_msg.Display
ole_doc.Documents.Close()
ole_doc.Quit()
destroy ole_doc
destroy ole_olk
destroy ole_msg
- this always strips the email of formatting, hyperlinks, and images even
though it's an HTML format
2)
ole_doc = CREATE oleobject
ls_filename = "C:\test.htm"
ole_doc.ConnectToNewObject("word.application")
ole_doc.visible = true
ole_doc.Documents.Open(ls_filename)
ole_doc.ActiveDocument.HasRoutingSlip = True
ole_doc.ActiveDocument.RoutingSlip.Subject = 'Test Subject'
ole_doc.ActiveDocument.RoutingSlip.AddRecipient('(e-mail address removed)')
ole_doc.ActiveDocument.RoutingSlip.Delivery = 0
ole_doc.ActiveDocument.RoutingSlip.ReturnWhenDone = false
ole_doc.Options.SendMailAttach = false
ole_doc.ActiveDocument.Route
ole_doc.Documents.Close()
ole_doc.Quit()
destroy ole_doc
- this sends the email with the document as an attachment. I've tried
"ole_doc.Options.SendMailAttach = false" as well without success.
I am writing this for a PowerBuilder 10 application but would take anything
I can get at this point...
Thanks
duplicate File -> Send To -> Mail Recipient. Macros have not been helpful as
I am not sure if Word is using an Outlook add-in to do the dirty work behind
the scenes.
Here is some of what I have tried so far...
1)
ole_doc = CREATE oleobject
ole_olk = CREATE oleobject
ole_msg = CREATE oleobject
ls_filename = "C:\test.htm"
ole_doc.ConnectToNewObject("word.application")
ole_doc.visible = true
ole_doc.Documents.Open(ls_filename)
ole_olk.ConnectToNewObject("Outlook.application")
ole_msg = ole_olk.createItem(0)
ole_msg.to = '(e-mail address removed)'
ole_msg.subject = 'Testing subj.'
ole_msg.BodyFormat = 2 //HTML
ole_msg.HTMLBody = ole_doc.ActiveDocument.Content
ole_msg.Display
ole_doc.Documents.Close()
ole_doc.Quit()
destroy ole_doc
destroy ole_olk
destroy ole_msg
- this always strips the email of formatting, hyperlinks, and images even
though it's an HTML format
2)
ole_doc = CREATE oleobject
ls_filename = "C:\test.htm"
ole_doc.ConnectToNewObject("word.application")
ole_doc.visible = true
ole_doc.Documents.Open(ls_filename)
ole_doc.ActiveDocument.HasRoutingSlip = True
ole_doc.ActiveDocument.RoutingSlip.Subject = 'Test Subject'
ole_doc.ActiveDocument.RoutingSlip.AddRecipient('(e-mail address removed)')
ole_doc.ActiveDocument.RoutingSlip.Delivery = 0
ole_doc.ActiveDocument.RoutingSlip.ReturnWhenDone = false
ole_doc.Options.SendMailAttach = false
ole_doc.ActiveDocument.Route
ole_doc.Documents.Close()
ole_doc.Quit()
destroy ole_doc
- this sends the email with the document as an attachment. I've tried
"ole_doc.Options.SendMailAttach = false" as well without success.
I am writing this for a PowerBuilder 10 application but would take anything
I can get at this point...
Thanks