Macro Problem

A

Al Jager

Sub SendMail()
Dim objOutlook As Object
Dim objMailItem As Object
Dim objRecipient As Object


Set objOutlook = CreateObject("Outlook.Application")

Set objMailItem = objOutlook.CreateItem(0)
Set objRecipient = objMailItem.Recipients.Add _
(ActiveSheet.Range("B2").Value)


objRecipient.Type = 1 '1 = To, use 2 for cc
objMailItem.Subject = "The extract has finished."

'Instead of the path to the file - I want to insert Active
Workbook in the next line
objMailItem.Attachments.Add _
("C:\Al Jager\! BookTest1.xls")
objMailItem.Display 'change to .Send if you don't
want to interact

End Sub
 

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