Macro enabled workbook loses its vba on close and re-open

XLJunky

New Member
Joined
Sep 14, 2011
Messages
3
I use an activeworkbook.saveas filename:=..., fileformat:=52 statement in vba to save a book for which i have inserted vba into its Thisworkbook Before_Save event procedure. It's there after the save, but when I close and then re-open the newly created workbook, the vba is no longer present in the ThisWorkbook module. It worked a few weeks ago. Why is the code getting wiped out? Any help would be greatly appreciated, Rick.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Apparently, some program, possibly McAfee, does like when one module attempts to write code to another module. I was doing this when putting the snippet of code in to the ThisWorkbook mod. Anyway, my add-in is now back to one big module, and all is well. My resultant book now retains its code. Thanks much for your consideration, Rick.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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