ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect/hide VB code? (https://www.excelbanter.com/excel-programming/407545-protect-hide-vbulletin-code.html)

Phil B[_4_]

Protect/hide VB code?
 
I am distributing an excel spreadsheet which includes cartographic functions
written in VB. They are starting to be used
in critical operations like search and rescue so I want to hide & password
protect the VB to prevent code changes, just as
you can with sheets and cells.
Is there any way of doing this? I happen to be using Office 2003 but the
code should be usable with previous and later versions.
Regards
Phil.



Phil B[_4_]

Protect/hide VB code?
 

"Phil B" wrote in message
...
I am distributing an excel spreadsheet which includes cartographic
functions written in VB. They are starting to be used
in critical operations like search and rescue so I want to hide & password
protect the VB to prevent code changes, just as
you can with sheets and cells.
Is there any way of doing this? I happen to be using Office 2003 but the
code should be usable with previous and later versions.
Regards
Phil.

Sorry - a senior moment.
http://www.ozgrid.com/VBA/protect-vba-code.htm answers it!
Phil



Howard Kaikow

Protect/hide VB code?
 
"Phil B" wrote in message
...

"Phil B" wrote in message
...
I am distributing an excel spreadsheet which includes cartographic
functions written in VB. They are starting to be used
in critical operations like search and rescue so I want to hide &

password
protect the VB to prevent code changes, just as
you can with sheets and cells.
Is there any way of doing this? I happen to be using Office 2003 but

the
code should be usable with previous and later versions.
Regards
Phil.

Sorry - a senior moment.
http://www.ozgrid.com/VBA/protect-vba-code.htm answers it!


Password protecting does not protect the code, there are ways to see such
code.

Best is to use VB 6 and compile DLLs, then include only a skeletal bit of
code in VBA to use the DLLs.,

For example, using MSFT Word, the code below is in my Normal.dot file.
The class is compiled into a VB 6 DLL.
And, the very same DLL is used for Word 2000, Word 2002, and Word 2003.
Similar things can be done with 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




All times are GMT +1. The time now is 09:56 AM.

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