Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide my VBA Code

Status
Not open for further replies.

barnard89

MIS
Mar 6, 2005
74
US
Hi

I am using Excel 2000 and I have written some macros inside my excel sheet

I do not want the end user to see my code or have any access to any of the macro VBA code that I had written
How could I have security for my code

This is what I have I done
In the Visual Basic Editor , I clicked on the project
-----> VBA Project properties.

Then in the Protection tab, I had set up a password .

But inspite of all this , the user still is able to view my code.
How I can stop this ? I need to have full security for my code from any one viewing it
Could anyone please suggest

 
Do a google search for excel vba password recovery and you'll be disappointed for full security ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi barnard89,

To hide a vba sub, simply prefix it with 'Private', eg:
Private MySub()

Alternatively, give it a dummy parameter, eg:
MySub(optional noArg as Boolean = True)
The 'noArg' variable means ' no arguments' but you can choose anything you want.

Neither of these would prevent someone running your code if they know thge sub names. To get around that, you could use an environment variable in the macro like:
If Environ("Username")<>Yourname Then Exit Sub
Even if users could see the macro, this would effectively stop anyone except you using it.

Yet another solution is to force the user to enter a password before the macro is run.


Cheers
 
Then in the Protection tab, I had set up a password .

But inspite of all this , the user still is able to view my code.
In what way is the user able to view your code? As PHV indicated, Excel is not a secure environment. But, a typical user should not be able to readily view your code.


Regards,
Mike
 
Hi,
a silly question, in the protection tab, do you have "Lock project for viewing" marked? Otherwise only access to project properties dialog is locked.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top