?
Solved

Stopping people seeing code in Excel

Posted on 2003-12-03
8
Medium Priority
?
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes
Suggested Courses

801 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