Sending a Single Worksheet by E-Mail

Makster83

New Member
Joined
Jan 30, 2012
Messages
1
I have created a worksheet containing a PivotTable report that I need to be able to send via e-mail.

I wrote some VBA code inside the worksheet titled "Rpt_Practice_Admin". It was taken from this website:
http://msdn.microsoft.com/en-us/library/bb268022.aspx

Scroll down to the section titled, "Sending a Single Worksheet by E-mail".


Here's a step-by-step account of what I did:
  • Wrote the VBA Code
  • Replaced the line ActiveSheet.Copy with Sheets("Rpt_Practice_Admin").Copy
  • Compiled, then executed (ran) the code.
  • A window appears on the screen reading:
"The following features cannot be saved in macro-free workbooks:
  • VB project
To save a file with these features, click No, and then choose a macro-enabled file type in the File Type list.

To continue saving as a macro-free workbook, click Yes."

  • Click "Yes".
  • Another window appears reading:
"A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date.


For more information about e-mail safety and how you might be able to avoid getting this warning, click Help."
  • Click "Allow".
  • The same window reappears with the same message.
  • Click "Allow".
  • The same window reappears one more time.
  • Click "Allow".
  • Signed into the e-mail account written inside the method .SendMail someone@somewhere.com, "This is the Subject line"
  • Check the Inbox and the worksheet was nowhere to be seen.
Where did I make my mistakes?

Regards.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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