Email Macro with Active Sheet as body of the attachment ... AND ... .pdf attachment

kevn.hudson

New Member
Joined
Sep 24, 2008
Messages
4
Help! I'm working to create a macro within Excel 2007 that emails (via Outlook 2007) the contents of a single worksheet within the body of an email ... AND ... attaches a .pdf file to email. I'd rather not create a new email if at all possible.

Below is the code I'm using to create the email, and it has shown the ability to successfully send the contents of a worksheet within the body of the email.


Sub Send_Range()
ActiveSheet.Range("A1:J58").Select

ActiveWorkbook.EnvelopeVisible = True

With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "xxxx@email.com"
.Item.Subject = "My subject"
.Item
End With

End Sub

BUT!!! Every time that I use the following command line (in theory to add the single file to be attached to the email), the debugger comes back and flags a problem.

.Attachments.Add "c:\users\ccccc.pdf"

I've also tried to use this command line, also to no avail ...
.Item.Attachments.Add "c:\users\ccccc.pdf"[/COLOR]

Any ideas, suggestions, thoughts, help ...

Signed, Completely Baffled :confused:
 
do you need the .add part?

Have you tried

Code:
.Attachments = "c:\users\ccccc.pdf"
 
Upvote 0
Hi Sous ... I did try it without the .add ... I also tried it as an .Item.Attachment ... In this case, it did send an email and made it through the debugger without an error - but didn't attach the file.
 
Upvote 0
Sorry, I'm at a loss. Hopefully someone else can chime in and save the day...good luck!
 
Upvote 0
You want to send an email and not actually create it.:huh:
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top