Solved

Stopping people seeing code in Excel

Posted on 2003-12-03
8
350 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scoreUp challenge 14 56
parentbit challenge 3 72
wordlen challenge 3 60
Beginner to Unreal Engine 4 5 57
This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

914 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

17 Experts available now in Live!

Get 1:1 Help Now