is it possible

dtaylor

Active Member
Joined
Mar 21, 2002
Messages
379
Hello All,
can all modules/vba be deleted via VBA?
I have a template I have created that retrieves data from a sql server. I want the user to be able click a command button to do a save as on the file and have the VBA deleted? Is it possible to have the code deleted on the file that is being saved?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Keep in mind that a user having multiple workbooks open will invoke your events, also. Have your events qualify themselves before they attempt to do anything.

Something along the lines of:
If ActiveWorkbook.name=ThisWorkbook.Name then.....

And you may want to explicitly declare the objects you want to modify, else you risk referencing the activeworkbook, the activesheet, etc.
 
Upvote 0

Forum statistics

Threads
1,224,427
Messages
6,178,587
Members
452,860
Latest member
jroberts02

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