MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Removing macros once saved


Posted by J Tompson on August 20, 2001 6:53 AM

Hi,

I have a worksheet that contains a macro forcing users to fill in textboxes etc. However, once they click ok this file is saved (soon to be placed on a intranet). Ideally i want to deactivate the macros and protect the worksheet once this is done. Is it possible?

Cheers,
John


Posted by Damon Ostrander on August 20, 2001 10:32 AM

Hi John,

I would suggest that on Save (using the workbook object's BeforeSave event) that you copy the worksheet(s) to a new workbook, protect and save that, and then use the Cancel argument of the BeforeSave event to cancel the save on the workbook containing the macros. This will do more than deactivate the macros--the workbook will not even contain them.

Damon