MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Run Once Then Delete Macro


Posted by Jeff on October 31, 2000 3:11 PM

I have some code that runs when the workbook opens, asks a few questions, formats and sets up the sheet, and then it need never run again. Unfortunately, in the future, when the workbook is opened, you get the macro warning. Is there a way to have a macro delete itself after running?


Posted by Ivan Moala on November 01, 2000 2:02 AM

Jeff
If you make this workbook as an addin that works
on a blank book then you can overcome this problem
OR change the code so that it creates a NEW workbook with these formating changes.....
Have a look @ this;
http://support.microsoft.com/support/kb/articles/Q156/9/42.asp?LN=EN-US&SD=gn&FR=0

for making an addin.


HTH

Ivan

Posted by David on November 01, 2000 9:32 PM


Another option is to put a sheet in the frontr and put all the code under that sheet and at the end have the macro delete the sheet. It cannot be self starting but with a button or maybe a sheet activation command you could probably get it to work. Or you could get a workbook that will open a new workbook and save to that one