Hiding Password in Spellcheck Macro

L

Lilbit

According to #2 in the instructions for the Spellcheck macro provided by
MVPS.org, if you put your password in the macro and, of course, want to
hide it, then go to Tools, Properties, and select the Protection Tab. I
did this and I assumed all I had to do was put in a password. However,
after doing this, I realized that if I do Tools, Macro, Visual Basic
Editor, Tools, Macros, select the macro, and select edit, the macro can be
examined. What am I missing? Thanks in advance for your detailed
response.
 
H

Howard Kaikow

you have to check the box "Lock project for viewing".
Note that such password protection is easily bypassed.

If you really want to protect your code, compile the code into a VB 6
ActiveX DLL and include only a stub in your template to run the code in the
DLL.
 
L

Lilbit

Thanks for your response Mr. Kaikow. Now if you could tell me or direct me
to a site where I can get detailed information on how to compile the code
in a VB6 ActiveX DLL and then include only a stub in the template to run
the code in the DLL, it would be very much appreciated. I am a beginner
who needs detailed explanations. Thanks again!!
 
D

Doug Robbins

I find it hard to believe that a protected form would warrant that level of
effort.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

Howard Kaikow

See http://www.standards.com/index.htm;?WordVBDLL for an example of how a
DLL Is used with Word.

1st, you would have to purchase VB 6, or Visual Studio 6.
MSFT no longer sells either product, but you may still be able to purchase
legal copies from places such as www.atomicpark.com.

Once you have VB 6, you create an ActiveX DLL in VB 5 and move all the VBA
code into the class in the DLL.
You then inlcude ONLY a stub in your Word template,, e.g.

Private clsX as MyClass

Public Sub AutoExec()
Set clsX = New MyClass
End Sub

Public Sub SomeMacroName()
With clsX
.SetClass Application, ActiveDocument, ThisDocument
.ActualMacroCodeHiddenInDLLForSomeMacroName
End With
End Sub

Where MyClass is your chosen class name.
I use the procedure SetClass in the DLL to pass things to the class.
You will need to pass at least the Application object to the class.
Anything else depends on what you are doing.

The easiest way to do this is to first develop the class in VBA itself.
You then move that code to VB 6 and compile the DLL.

You could even use a VB 6 Form, instead of a VBA Userform, depends on what
you are doing.
 
H

Howard Kaikow

Doug Robbins said:
I find it hard to believe that a protected form would warrant that level of
effort.


The OP is talking about protecting the code, not the form.
 
D

Doug Robbins

I realise that, but they are starting with a form that is protected with a
password and they want to use the macro that has to be used so that it can
be spell checked. That necessitates that the macro contain the password
that was applied to the document. Insecure as you say protecting a macro
might be, I can't really see the users of the form being that inclined to
try and break the protection on the macro so that they can get the password
that is protecting the form.

I consider that under the circumstances, the security afforded by protecting
the macro is probably sufficient.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

Howard Kaikow

Doug Robbins said:
I realise that, but they are starting with a form that is protected with a
password and they want to use the macro that has to be used so that it can
be spell checked. That necessitates that the macro contain the password
that was applied to the document. Insecure as you say protecting a macro
might be, I can't really see the users of the form being that inclined to
try and break the protection on the macro so that they can get the password
that is protecting the form.

I consider that under the circumstances, the security afforded by protecting
the macro is probably sufficient.

With VB 6 DLL,. the macro password would be in the DLL, and, for further
protection, the password could be encrypted in the code.

The bottom line is the real value of the code that needs to be protected,
only the OP can judge that.

The first time the OP create a DLL, I expect that the OP will find this
difficult, but once the technique is learned, it is just about as easy to
code VBA in a VB 6 DLL as it is in Office VBA itself.
 

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