Emailing From Word/ Word Document as Body

I

Ian

I am currently pulling my hair out over this issue.

I want to duplicate these actions in word...
- Opening a word document
- File -> SendTo -> Recipients.
This leaves the document intact. I need the email to reflect the document as
is.. ie images, formatting, html links etc....


Sendmail() - attaches the document or converts the body to text and leaving
out everything else.
Document.Content - I have also tried grabbing the document content and
slapping it in outlook messages of various formats without success.


What objects and functions leave the document content intact for the message
body?
 
T

texasHawkeye

I also need to do this. 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 = 'sjk'
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top