Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Friends,
In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The only way to prevent a user from going into "design" mode, or simply
opening the VBE with alt-F11 and looking at your project, is to lock the project with a password. Rt-click the project, Project properties, Protection, check the lock checkbox and add the password. VBE project passwords are much more secure than say worksheet/workbook passwords, but that's a relative term, relatively easy to hack. Procedures in Object modules (Sheet & Thisworkbook) will not be seen in Macros (Alt-F8) or the function wizard (shift-F3). Regards, Peter T "WCM" wrote in message ... Hi Friends, In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you have password protected the VBA project, the user will not be able
to view any of the VBA code in the workbook (including sheet modules) without either suplying the password or removing it. If you right-click on the tab of the sheet with the command button and select 'View code', you should be presented with a password entry dialog. Likewise, if you go into design mode, right-click on the command button and select view code. When you password-protect the VBA project, you have to save, close, and re-open the workbook to test it. Hope this helps, Hutch "WCM" wrote: Hi Friends, In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Somehow I missed you said you had password protected the project. Save close
and re-open the file and you should be presented with the password dialog before you can get into the project. Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... The only way to prevent a user from going into "design" mode, or simply opening the VBE with alt-F11 and looking at your project, is to lock the project with a password. Rt-click the project, Project properties, Protection, check the lock checkbox and add the password. VBE project passwords are much more secure than say worksheet/workbook passwords, but that's a relative term, relatively easy to hack. Procedures in Object modules (Sheet & Thisworkbook) will not be seen in Macros (Alt-F8) or the function wizard (shift-F3). Regards, Peter T "WCM" wrote in message ... Hi Friends, In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, Tom. You are right - once I closed and re-opened workbook, got in
vba design mode, and double-left-click on command button, I needed to enter the project pwd to see the code. I had been testing security before close/open of workbook - that was my only problem. Thanks again ... bill "Tom Hutchins" wrote: Since you have password protected the VBA project, the user will not be able to view any of the VBA code in the workbook (including sheet modules) without either suplying the password or removing it. If you right-click on the tab of the sheet with the command button and select 'View code', you should be presented with a password entry dialog. Likewise, if you go into design mode, right-click on the command button and select view code. When you password-protect the VBA project, you have to save, close, and re-open the workbook to test it. Hope this helps, Hutch "WCM" wrote: Hi Friends, In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Peter - thank you. That did it. Just need to close/re-open workbook.
"Peter T" wrote: Somehow I missed you said you had password protected the project. Save close and re-open the file and you should be presented with the password dialog before you can get into the project. Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... The only way to prevent a user from going into "design" mode, or simply opening the VBE with alt-F11 and looking at your project, is to lock the project with a password. Rt-click the project, Project properties, Protection, check the lock checkbox and add the password. VBE project passwords are much more secure than say worksheet/workbook passwords, but that's a relative term, relatively easy to hack. Procedures in Object modules (Sheet & Thisworkbook) will not be seen in Macros (Alt-F8) or the function wizard (shift-F3). Regards, Peter T "WCM" wrote in message ... Hi Friends, In my Excel Project, I have hidden all VBA code modules by inserting 'Option Private Module' in the General Declarations section; I have also password protected the VBA project. Question: I have a command button on one worksheet - the button has VBA code behind it (simple code that calls a sub proc from a code module). I would like to hide the code behind the button, but there seems to be no way to hide code that is in an Object Module (as opposed to a standard Code Module). Any way to hide code that is behind a command button so user cannot go into VB design mode and see that code behind the button? Note: Assume that protecting the worksheet is not an option. Thanks in advance ... Bill |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Option Private Module | Excel Programming | |||
Improve method of calling a private function in a private module | Excel Programming | |||
Option Private Module | Excel Programming | |||
Public, Private, Event modules, Forms modules,,, | Excel Programming | |||
Option Private Module not preventing cross project referencing | Excel Programming |