Losing VBA when emailing spreadsheet

bclor3591

New Member
Joined
Oct 7, 2010
Messages
33
Is there a way to send the VB code for buttons and macros with the spreadsheet when emailing from within excel? I have a button to send a spreadsheet through outlook, but when the file arrives at recipient the code and macro are not there.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
You want to email the whole workbook including its code? or just one worksheet of your workbook
 
Upvote 0
Hello VBA Geek,

Yes, I'm trying to email 1 spreadsheet with 3 buttons (with the 2 macros and the VB code). The buttons work fine, but when I send the file the buttons show up with the data on the aspreadsheet, but the VB cose and macros doesn't go with the spreadsheet. I can send the code if you need it. I have to figure out how to attach VB code and macros to this post???
 
Upvote 0
The two buttons are Active X controls, command button? whereas the 3rd is in a standard module?
 
Upvote 0
Under the Developer Tab, Actually, all 3 buttons are Active X Controls. Then I added a MODULE down at the Worksheet level and that is where I put the LESS DATA & MORE DATA macros. The VB code that has the CommandButton1-3 logic was added to the Sheet1 worksheet.
 
Upvote 0
if you use

thisworkbook.sheets("sheetToemail").copy

the new workbook will contain just this worksheet and the code at the worksheet level should be in there too
 
Upvote 0
Hello VBA Geek,

I tried to add the code above to my code, but I'm not quite sure where it needs to go. I can send you the code for your review if I can figure out how to attach it to these posts?
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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