Thread: File Protection
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default File Protection

Something I have done to force the use of macros is to create a "Splash
Sheet" with the message "Macros must be Enabled to access this Workbook.
Close & Re-Open with Macros Enabled". Now in your Workbook_Close event, hide
all workbook sheets, but unhide the Splash Sheet. You could go as far as to
make them xlVeryHidden so they won't be listed in Format/Sheets/Unhide menu.
Now in your Workbook_Open event, hide the Splash Sheet and Unhide all other
sheets. As you can see if macros are NOT enabled, the Workbook_Open event
code will not run and only the Splash Sheet message will be visible.
To further protect your code modules from curious eyes you can password
protect the Project from VBEditor.

Mike F
"ChasAA" wrote in message
...
Hello All,
I would like to develop a VBA whereby users are only able to access the
Excel file if they run the VBA code. Is there any way of doing this.

I can stop users (via code):

Closing Userforms etc.
Deleting/Adding rows and columns
Disable the menu

Another thing I thought was to protect the Workbook and only Unprotect it
via VBA code.

If the user choses "Disable Macros" at the security prompt, then they will
have full access to the data. Is there a way to stop this.

Reason why I want this is because the application will be one where
employess can book their annual leave. Each person has a limited number
of
days they can book and on each day only a limited number of employees can
be
off.

As you can imagine if they have full access they can book what they want!

Any suggestions as to what I can do?

Thanks in advance.

Chas