Solved

Stopping people seeing code in Excel

Posted on 2003-12-03
8
349 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 …
A short article about a problem I had getting the GPS LocationListener working.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now