Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2008

    Unanswered: Can Outlook.Application .Body be split or .Attachments be manipulated inside it?

    This isn't really a database question, but I'm trying to code an outlook mail object in my Access application VBA so I thought somebody here might know about that. Hope it's not too far off topic.

    Anyway, I'm wondering if there's a way to do things with the .Attachments for an Outlook mailitem .Body when it is formatted as Rich Text, like reposition them some place other than the end of it. Would also like to add tabs or just spaces in between each attachment. It automatically puts .Attachments at the end of the .Body text with no space between them. Formatted as HTML, it just puts them in the attachments box near the subject of an email. Which doesn't work for me either.

    Basically is there a way to split the .Body in two, put in the first part of the text, add the .Attachments, then put in the second part underneath?

    Here is some code for what I'm doing:
    Set olApp = Outlook.Application
    Set objMail = olApp.CreateItem(olMailItem)

    With objMail
    Msg = "Some stuff"
    .BodyFormat = olFormatRichText

    '* ASCII CR & LF to put the attachments on the line after the end of the .Body
    Msg = Msg & Chr(13) & Chr(10)

    '* Get any attachments, these wind up at the end of .Body
    Do While Not rs2.EOF
    strDocName = rs2.Fields("TaskDocName")
    strDocPath = rs2.Fields("TaskDocPath")
    .Attachments.Add strDocPath, olByValue, , strDocName

    .Body = Msg
    .Subject = "Subject of some kind"
    .To = ""

    '* display the email so it can be sent manually
    End With

    Set rs2 = Nothing
    Set objMail = Nothing
    Last edited by bhavdahl; 06-20-08 at 17:36.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts