Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Delete userform/module using VB

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Delete userform/module using VB

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Delete userform/module using VB

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Delete userform/module using VB

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



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Delete userform/module using VB

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


.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Delete userform/module using VB

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to delete module / macro in another file Ray Clark[_2_] Excel Discussion (Misc queries) 1 July 3rd 08 04:15 AM
Delete macro that is not in a module [email protected] Excel Discussion (Misc queries) 5 September 21st 07 06:15 PM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
Delete a module Steve M Excel Discussion (Misc queries) 2 March 28th 05 02:59 PM


All times are GMT +1. The time now is 12:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"