View Single Post
 
Old 07-05-2012, 08:09 AM
OTPM OTPM is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default SendMail Code

Hi
Replace the current code on the button with this (cut and paste):

Private Sub Send_Mail_Click()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.To = "otpm@blueyonder.co.uk; tk_hussar@hotmail.com; tk_hussar@hotmail.com" 'CHANGE THESE EMAIL ADDRESSES TO THE ONES YOU WANT TO USE.
.Subject = "Completed Flight Safety Occurence Form"
.Body = "Please find herewith completed Flight Safety Occurence Form for your action."
.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Doc.FullName
.Send
End With

Application.ScreenUpdating = True

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub

You need to change the email addresses above as indicated. This code will send the emails without activating Outlook. Use a test email address first to test the routine.

Let me know how you get on.

OTPM (Tony)
Reply With Quote