How do I create a macro to email a file

R

Roger

I have read your post about creating macros but am confused. I understand
that I need to create a macro using VBA from the VBA editor, or copy it from
somewhere and paste it into my Outlook macros. That seems to be okay, but
where can I find a macro to copy. All I want to do is to create a new email,
attached a file, and email it to an address. The address won't change, and
the file to be attached (weekly) won't change. It seems to be simple enough,
but I can't find the code that i need to do it !

Can you help me, please ?

Roger
 
G

Guest

Who's post are you referring to? If you're looking for samples, there's
plenty in the Outlook VBA Help file as well as at http://www.outlookcode.com.

Here's a macro to attach and e-mail a file:

Sub AttachFileAndEmail()
Dim objMail As Outlook.MailItem

Set objMail = Application.CreateItem(olMailItem)
objMail.To = "(e-mail address removed)"
objMail.Attachments.Add "C:\Temp\test.txt"
objMail.Subject = "My Subject Line"
objMail.Send

Set objMail = Nothing
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