Attachment not printing in correct location

A

Alt255

I have some code that creates a MAPI instance and adds a message body
with a few chr(13), then adds an excel attachment. When I look at
these emails on the monitor, the attachment is several lines after the
body, but if I print an copy of the email, the attachment is always
before the message and looks a little funny.

I checked what happens if I manually insert an attachment after the
message body, and the email prints fine ( attachment after the body).

This is not a show stopper, but I have been googling this problem to
no avail, does anybody have any ideas/solutions?
 
K

Ken Slovak - [MVP - Outlook]

By MAPI instance you mean a CDO 1.21 Session?

How are you adding the attachments, what settings are you using?
 
A

Alt255

By MAPI instance you mean a CDO 1.21 Session?

How are you adding the attachments, what settings are you using?












- Show quoted text -

I'm using the Outlook object library inside Aceess

Dim outlk As Outlook.Application
etc...


This is the piece where I build the email

Set mitem = outlk.CreateItem(olMailItem)
strAttachment = rst0.Fields("file_location")
mitem.Recipients.Add strRecip
mitem.Subject = strSubject
mitem.Body = strMsg & Chr(13) & Chr(13)
mitem.Attachments.Add strAttachment


As I said, the file is below the body in when viewing it on the
monitor, but trhe icon is showing at the top when I read a printout.
 
K

Ken Slovak - [MVP - Outlook]

OK, an Outlook session and not a CDO (MAPI) session.

That's about all you can do using the Outlook object model. About all you
could do different is to play with the message format since attachments are
added differently with different formats. Printing has been a dead area with
Outlook since day 1, no printing enhancements have been made since adding
printing HTML.

To do anything differently you'd need to use a lower level API such as
Extended MAPI (C++ or Delphi only), CDO 1.21 (deprecated and optional
installation) or something like Redemption (www.dimastr.com/redemption)
which is a COM wrapper around Extended MAPI. Even then Outlook can have a
mind of its own. Try inserting a ClipArt image some time using WordMail and
see how odd the attachments and HTML code looks.




<snip>
I'm using the Outlook object library inside Aceess

Dim outlk As Outlook.Application
etc...


This is the piece where I build the email

Set mitem = outlk.CreateItem(olMailItem)
strAttachment = rst0.Fields("file_location")
mitem.Recipients.Add strRecip
mitem.Subject = strSubject
mitem.Body = strMsg & Chr(13) & Chr(13)
mitem.Attachments.Add strAttachment


As I said, the file is below the body in when viewing it on the
monitor, but trhe icon is showing at the top when I read a printout.
 

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