MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Excel Protection - VBA Form

  Asked By: Reginheraht    Date: Dec 22    Category: MS Office    Views: 1910

I have an Excel database (Spreadsheet) that is accessed via a form I
generated using VBA. I want everyone to be able to add data to the
database (Excel spreadsheet) through the form, but I don't want anyone
to be able to edit the data once in the databse (excel spreadsheet) or
modify my vba code.

Is there an easy way to manage this, or must I make alot more calls to
the protection functions etc?

Does anyone have code that is similar in nature to what I am trying to
do that I can use as a template for this project?



3 Answers Found

Answer #1    Answered By: Brandi Ramirez     Answered On: Dec 22

How "sophisticated" are your users?
The reason I ask is: it's fairly simple to password protect the VBA code.
Once you've done so, you can create a

Private Sub Worksheet_Activate()

sub that basically selects another sheet...
The only problem with this approach, is that if the users are just a "little"
they can simply create a VBA sub in their own personal.xls file
that does:

Application.EnableEvents = false

and the sheet is "unlocked".

Another way is to do as you said, and make a lot more call to the
protect/unprotect functions  for the sheet.

Answer #2    Answered By: Archie Parker     Answered On: Dec 22

I was just about to post that I found the simplest way to
protect/unprotect the sheet for data  entry into the database, but
the code  contains the password and the code is viewable and
editable. Is there a way to hide this? I was looking at encryption,
but I don't really understand how that works.

The users, just fyi, are engineers from varrious disciplines,
including cs. I would like to protect this using zimmerman's pgp,
but that would probably defeat the purpose.

Ay suggestions?

Answer #3    Answered By: Hamdan Younis     Answered On: Dec 22

No additional code  needed.

From the VB Editor, set the Visible Properties on the data  worksheet
to Very Hidden. Your Form can still write to a hidden worksheet. In
the VBE, look at the VBAProject Properties for your project
(Right-Click on your project) and Lock the project  for viewing.

Anyone savvy enough - and mean enough - can still overwrite your data
but it'll make it much more difficult to do so. Most Users that I
work with don't even know that there is a VB Editor.

Didn't find what you were looking for? Find more on Excel Protection - VBA Form Or get search suggestion and latest updates.