Protect/hide VB code?

P

Phil B

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.
 
P

Phil B

Phil B said:
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
 
H

Howard Kaikow

Phil B said:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top