Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create email and attach file

Status
Not open for further replies.

DH

Programmer
Joined
Dec 8, 2000
Messages
168
I can use the following code to create an email message in Outlook 2000 and attach a file. However, the file attaches at the beginning (top left corner) of the email. Any suggestions on how to get the attachment to attach at the end of the email.

Private Sub Command0_Click()
Dim stpath As String
Dim appoutlook As Outlook.Application
Dim mailoutlook As Outlook.MailItem
Set appoutlook = CreateObject("outlook.application")
Set mailoutlook = appoutlook.CreateItem(olMailItem)
stpath = "C:\Documents and Settings\Owner\Desktop\abc.pdf"
With mailoutlook
.To = "email@emailaddress.com"
.Subject = "Test"
.Body = "Test Attachment"
.Attachments.Add stpath
.Display
End With
End Sub

.Display lets you preview the email message before its sent. When previewing the email I can goto Format on the toolbar and change the Format to "Plain Text" which then causes the email to attach in a new window pane a the bottom of the email. Is it possible to do this from code?

Thanks

DH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top