Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing file printing, saving changes to limit demo functionality

Status
Not open for further replies.

bridgeart

Structural
Nov 26, 2005
30
I would like to allow others to view my excel file but I want to prevent them from (1) printing the file and (2) saving any changes they might have made. I would like to utilize this in a demo version of Excel application. The goal is to have the users obtain full version if they find it useful and would like to continue using it. Are there any are other simple, effective and "tamper-proof" ways to limit Excel file functionality that could be utilized to create demo version of spreadsheet application? Thanks for any ideas.

--
 
Replies continue below

Recommended for you

The only thing that comes to mind right off, with out using Microsoft's Rights Protection is to simply use the work sheet protection built into Excel. Lock all of the cells in the work sheet except for those that you want the user to be able to edit. On your page set-up option on the file menu, set the print range to just cell A1. When you save the work book with the protection in place, you can specify that the user can only select the unlocked cells. As such, I don't think that they would be capable of changing the print range even, except to those cells which you specified as being selectable, your unlocked cells. And since they can not select the locked cells, they won't be capable of copying and pasting to a new workbook either.
 
Locking the print area doesn't work that way in my version (XL97). You can always clear it. However, you can add a workbook event procedure (yes, in the VB editor), Workbook_BeforePrint. It should look like this:
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Cancel = True
End Sub
Then, protect the VB project.
However, if the user disables macros when opening the file, this macro will be disabled as well :-(


Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Markn82, I experimented with what you suggested and found that it is not completely tamper-proof, because the user can change the print range to the entire sheet from "File -> Print Area -> Clear Print Area" (accessible even when both the sheet and workbook are protected). You also mentioned Microsoft's Rights Protection - what is that and where can I find more information about it? Thanks.

--
 
well, there sort of is a technique, but its effectiveness and usefulness is questionable. it has been many years since i did this myself, and i was not completely successful in meeting the same objectives you've stated.

from what i remember, simply remove all commands/menu items/toolbars from the workbook menu and save the workbook. might even want to protect the workbook after making the changes. highly recommend you experiment on a dummy workbook before embarking on actual workbook. how to remove sub-menus (when right clicking) needs to be disabled as well.

usually, the objectives you've stated are used by developers or knowledgeable users of excel. there are websites available that may provide you the details or examples of what you desire.

if further direction or references is needed, feel free to ask.

meanwhile, good luck!
-pmover
 
Thank you all for your suggestions! Here is what I eventually came up with:

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    MsgBox "WARNING - printing disabled in demo version!"
    Cancel = True
End Sub


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox "WARNING - saving changes disabled in demo version!"
    Cancel = True
End Sub


Private Sub Workbook_Open()
    ActiveWorkbook.Unprotect "whatever_password"
    Sheets("Main").Activate
    Sheets("Main").Visible = True
    Sheets("EnableMacros").Visible = False
    ActiveWorkbook.Protect "whatever_password"
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ActiveWorkbook.Unprotect "whatever_password"
    Sheets("EnableMacros").Activate
    Sheets("EnableMacros").Visible = True
    Sheets("Main").Visible = False
    ActiveWorkbook.Protect "whatever_password"
End Sub


If the user disables macros when opening the file, all sheets will be hidden, so the spreadsheet will not be very useful. Here is a sample file:


Thanks again!

--
 
It's worth remembering that there are heaps of free and cheap Excel unlockers available on the internet. Internal XL protection is not a commercial grade protection and it's generally viewed as being suitable for discouraging casual inspection. A compiled VB app may be a more satisfactory solution for commercial use.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor