Outlook 2007 Attachment Position

M

mark.t.andrews

I am having a problem getting a file attachment to be positioned where
I need it. I am executing code from MS Excel to create an email
message in Outlook. In 2003, the position parameter positions my
attachment correctly, but so far, I have had no luck getting Outlook
to position my attachments where I tell it to. No matter what I put
in the position parameter, it puts the attachment after the last
character in my body text. The only difference is if I put '1' in the
position parameter and the attachment is positioned before the first
character of my body text. Is there a known problem with the
attachment parameter in Oulook 2007?

Here is the code that I am using:

With mobjolMail
.Subject = gstrEmail_Subject
.SentOnBehalfOfName = gstrEmail_Signature_1
.Importance = olImportanceHigh

' Loop through recipients.
'
For mintRow_Index = 2 To glngEnd_Row
.Recipients.Add (ActiveSheet.Cells(mintRow_Index, 1))
Next mintRow_Index

.Body = gstrEmail_Body & _
vbCrLf & vbCrLf & _
" " & _
vbCrLf & vbCrLf & _
gstrEmail_Signature_1 & vbCrLf & _
gstrEmail_Signature_2

mstrReport_Name = Dir(gstrReport_Path & mstrReport_Name_Zip)

If mstrReport_Name = vbNullString Then

gstrMsg_Text = "The report file: " & mstrReport_Name_Zip
& _
", was not found in the folder: " & gstrReport_Path &
_
"." & _
vbLf & vbLf & _
"Verify that the report is correctly coded in the
System File " & _
"Workbook, in the Excel App Information Library and
that the file " & _
"exists before attempting to create this email message
again."

MsgBox gstrMsg_Text, vbOKOnly + vbInformation,
gcstrMsg_Title

Else

mintAttachment_Position = Len(gstrEmail_Body) + 3

Do While mstrReport_Name <> vbNullString
.Attachments.Add gstrReport_Path &
mstrReport_Name_Zip, olByValue, _
mintAttachment_Position, mstrReport_Name

mstrReport_Name = Dir
Loop

' Saves the message for later editing in the users
"Drafts" Outlook folder.
'
.Move mobjolDrafts_Folder

mblnEmail_Saved_To_Draft = True

End If

Set mobjolMail = Nothing

End With
 

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