Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
Is it possible to delete a userform or module from an Excel project programmatically? If it is possible, can you provide some sample code or point me to a website where I can find some? Thanks, Rohit Thomas |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rohit,
See www.cpearson.com/excel/vbe.htm for details for this sort of thing. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rohit Thomas" wrote in message ... Hello All, Is it possible to delete a userform or module from an Excel project programmatically? If it is possible, can you provide some sample code or point me to a website where I can find some? Thanks, Rohit Thomas |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chip,
Thanks for the response. I took a look at your website and have one question....If my project is password protected, is there code that I can run to unprotect it before deleting the userform or module. It would need to be protected after the useform or module is deleted. Thanks, Rohit -----Original Message----- Rohit, See www.cpearson.com/excel/vbe.htm for details for this sort of thing. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rohit Thomas" wrote in message ... Hello All, Is it possible to delete a userform or module from an Excel project programmatically? If it is possible, can you provide some sample code or point me to a website where I can find some? Thanks, Rohit Thomas . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rohit, you can use the following:
ThisWorkbook.Unprotect Password:="passwd" Substitute your known password for "passwd". Protect works the same way. Same goes for the ActiveWorksheet. Execute them in the Workbook_Open and Workbook_BeforeClose event subs. Randall Arnold "Rohit Thomas" wrote in message ... Chip, Thanks for the response. I took a look at your website and have one question....If my project is password protected, is there code that I can run to unprotect it before deleting the userform or module. It would need to be protected after the useform or module is deleted. Thanks, Rohit -----Original Message----- Rohit, See www.cpearson.com/excel/vbe.htm for details for this sort of thing. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rohit Thomas" wrote in message ... Hello All, Is it possible to delete a userform or module from an Excel project programmatically? If it is possible, can you provide some sample code or point me to a website where I can find some? Thanks, Rohit Thomas . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, you're right-- I was just thinking of the Workbook.
Personally, I don't think it's a good thing to be able to programmatically unprotect the code... one has to simultaneously deal with self-reference, quantum mechanics and time travel. Who needs THAT??? ; ) Randall Arnold "Chip Pearson" wrote in message ... Randall, ThisWorkbook.Unprotect Password:="passwd" That doesn't unprotect the VBProject -- the VBA code behind the workbook. Unfortunately, there is no way to programmatically protect or unprotect a VBProject. You can sometimes get SendKeys to do it, but I don't recommend it. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Randall Arnold" wrote in message ... Rohit, you can use the following: ThisWorkbook.Unprotect Password:="passwd" Substitute your known password for "passwd". Protect works the same way. Same goes for the ActiveWorksheet. Execute them in the Workbook_Open and Workbook_BeforeClose event subs. Randall Arnold "Rohit Thomas" wrote in message ... Chip, Thanks for the response. I took a look at your website and have one question....If my project is password protected, is there code that I can run to unprotect it before deleting the userform or module. It would need to be protected after the useform or module is deleted. Thanks, Rohit -----Original Message----- Rohit, See www.cpearson.com/excel/vbe.htm for details for this sort of thing. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rohit Thomas" wrote in message ... Hello All, Is it possible to delete a userform or module from an Excel project programmatically? If it is possible, can you provide some sample code or point me to a website where I can find some? Thanks, Rohit Thomas . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
code to delete module / macro in another file | Excel Discussion (Misc queries) | |||
Delete macro that is not in a module | Excel Discussion (Misc queries) | |||
CLASS MODULE & SIMPLE MODULE | Excel Discussion (Misc queries) | |||
code in module A to not execute a Worksheet_SelectionChange sub of another module | Excel Discussion (Misc queries) | |||
Delete a module | Excel Discussion (Misc queries) |