Solved

Stopping people seeing code in Excel

Posted on 2003-12-03
8
351 Views
Last Modified: 2010-04-17
I am using ExcelXP

I know how to password protect the code. What I don't know how to do, is to hide the code after "unlocking it", short of closing down the application and reopening it.

I know this might seem trivial to close down and reopen the application but it is a big Excel application running over a slow network!
0
Comment
Question by:gordontm
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:victoresq
ID: 9874806
no need to worry mate,

each person who opens the XLS file will start a new "instance" of the file.

So while you are working on it in on your box in your instance, it is totally different from Suzzie Q trying to see the code.

I created an XLS spreadsheet on the network that contained a single comment in the click event of a button that said " 'I am hiding from the world "

I put a password and closed the file the first time.

When I re-opened it from my box, it of course wanted the password. so when I gave it, I was granted access.

From another box I opened the same file, it of asked me for the password to see the same code (even though I had opened it earlier and continued to keep it opened.

Let me know if this is not the behavior you experience.

whodaman
0
 
LVL 2

Author Comment

by:gordontm
ID: 9874964
Thank you for your comments...
I may not have explained myself well enough.

I want to go to a User's machine. She is using a program I wrote, and I want to make a quick change to the code. If I enter the password and make the change, I am forced to close down the program afterwards in order to stop further access to the code on that machine.
0
 
LVL 1

Expert Comment

by:victoresq
ID: 9876917
I can feel your pain, I was doing this for Enron (before the defunction) and would have to relay to that user that just like any development should be done on my box (for testing).

the design mode button is the seventh button in the visual basic toolbar...basically you are turning the enabling on and off for this item.  set the passwords to whatever you like...see ya.

whodaman

********************************************************

Private Sub CommandButton2_Click()
Call checkProtectionforVBProject
End Sub


Private Sub checkProtectionforVBProject()

    Dim userAnswer As String
   
    userAnswer = InputBox("password please")
   
    If userAnswer = "u" Then

        Application.Toolbars("Visual Basic").ToolbarButtons(7).Enabled = True

    ElseIf userAnswer = "p" Then

        Application.Toolbars("Visual Basic").ToolbarButtons(7).Enabled = False
   
    Else
   
        MsgBox "Your answer was not recongnized"
   
    End If

End Sub

0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 1

Expert Comment

by:victoresq
ID: 9903197
did this help?
0
 
LVL 2

Author Comment

by:gordontm
ID: 10497380
Victoresq
Hi. Thanks for your comment. I am really sorry for the 2 month delay in replying - I have been really snowed under at work and didn't have time for this development.
I am afraid that this isn't exactly what I was looking for.
I see that the code will enable or disable the Design button in the vb toolbar. However it doesn't stop me going into the code with ALT-F11
Even if Use your code to disable the 4th button (Visual Basic Editor) it is still possible to go in via the menus or via the keyboard (ALT-F11)
Thanks anyway





0
 
LVL 1

Accepted Solution

by:
victoresq earned 125 total points
ID: 10497746
Can I write VBA code to protect or unprotect my VB Project?

No. The VBE object model has no provisions for this.

presumably an attempt to thwart password-cracking programs.

per Microsoft.

You must close the project in order for the password protection to re-initialize.

victor
0
 
LVL 2

Author Comment

by:gordontm
ID: 10522588
Thank you! Have a good weekend
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question