ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect View Code? (https://www.excelbanter.com/excel-programming/411118-protect-view-code.html)

AM

Protect View Code?
 
Is there a way to protect view code (I mean users cannot right click and view
code?)

Norman Jones[_2_]

Protect View Code?
 
Hi AM,

In the VBA editor:

Menu | Tools | VBA Properties |
Protection | Lock Project foe viewing [x] |
Enter and confirm password | OK
Save, close and re-open workbook.



---
Regards.
Norman


"AM" wrote in message
...
Is there a way to protect view code (I mean users cannot right click and
view
code?)



Howard Kaikow

Protect View Code?
 
"Norman Jones" wrote in message
...
Hi AM,

In the VBA editor:

Menu | Tools | VBA Properties |
Protection | Lock Project foe viewing [x] |
Enter and confirm password | OK
Save, close and re-open workbook.


THat's not a secure means,

Best way is to comppile the code into a VB 6 DLL, and just have stubs in the
the .xls.
For example, using Word, the following is in my Normal.dot, but the real
code is in a DLL.
Same can be done in Excel.

Option Explicit
Public clsWordVBNormal As WordVBNormal

Public Sub AutoClose()
SetupClass
clsWordVBNormal.clsAutoClose
End Sub

Public Sub AutoExec()
SetupClass
End Sub

Public Sub AutoExit()
SetupClass
clsWordVBNormal.clsAutoExit
End Sub

Public Sub AutoNew()
SetupClass
End Sub

Public Sub AutoOpen()
SetupClass
End Sub

Public Sub ResetToolsOptionsView()
SetupClass
clsWordVBNormal.clsResetToolsOptionsView ActiveDocument
End Sub

Private Sub SetupClass()
If TypeName(clsWordVBNormal) < "WordVBNormal" Then
Set clsWordVBNormal = New WordVBNormal
clsWordVBNormal.SetClass Application
End If
End Sub



AM

Protect View Code?
 
Thank you all for the help. Very helpful and great people on this board.

Best,
AM

"Norman Jones" wrote:

Hi AM,

In the VBA editor:

Menu | Tools | VBA Properties |
Protection | Lock Project foe viewing [x] |
Enter and confirm password | OK
Save, close and re-open workbook.



---
Regards.
Norman


"AM" wrote in message
...
Is there a way to protect view code (I mean users cannot right click and
view
code?)




All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com