View Full Version : email & attachment word doc.

05-09-2011, 07:43 PM
Hi I have the below code that I use for sending an email automatically. I would like to adapt it to include a Word Doc as an attachment to this email. The Doc. will be kept in the same folder as the workbook.

Dim Email_Subject, Email_Send_From, Email_Send_To, _
Email_Cc, Email_Bcc, Email_Body As String
Dim Mail_Object, Mail_Single As Variant
Email_Subject = ""
Email_Send_From = ""
Email_Send_To = ""
Email_Cc = ""
Email_Bcc = ""
Email_Body = "Test only"
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc

What else can I put into this to attach the word doc in the same folder automatically?

05-12-2011, 03:12 PM
Is there a
.add.attchment.word.doc name Same path as saved file possibility?

05-14-2011, 12:16 AM
I would have thought it would be like this...
.Attachments.Add ThisWorkbook.Path & "\" & "FileName.doc"
Hope this helps

05-14-2011, 08:42 AM
Hi Georgiboy, it seems I have your code working. But have one other issue. If the attachment in not there I get an error. Is there a way to resolve this that is attachment is not there continue...?

05-16-2011, 06:12 AM
'workbook is already saved and has a name
'no . are used in the naming for files
If InStr(ThisWorkbook.Name, ".") > 0 Then
'check if a file exists in this directory
If Dir(ThisWorkbook.Path & Application.PathSeparator & _
Split(ThisWorkbook.Name, ".")(0) & ".doc") <> vbNullString Then
MsgBox Split(ThisWorkbook.Name, ".")(0) & ".doc is found."
MsgBox Split(ThisWorkbook.Name, ".")(0) & ".doc not found."
End If
MsgBox "Save your workbook first."
End IfCharlize