View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_5_] Stuart[_5_] is offline
external usenet poster
 
Posts: 413
Default Protect file on a shared Network drive

Thanks for the ideas.

Regards.

"Jake Marx" wrote in message
...
Hi Stuart,

Stuart wrote:
I place a file on a network drive which is available to all
users.

I tell the users to copy the file to their own drive (either
network or local) and open the copy there. If they do so,
then code in the ThisWorkbook module will complete the
process.


Instead of telling users to copy the file to their local drive, you could
force the issue with ThisWorkbook.SaveCopyAs.

By placing the file centrally on the common network
drive, I figure that updates will be easier to manage,
but, two questions please:

1. Can I detect the file being opened from its's
original location, and stop code executing,
prompting user to first copy the file.


You could check ThisWorkbook.Path and see if it matches the network
location. If so, display a message and stop executing.

I would also recommend making the workbook read-only. In addition, if you
have the ability to set NTFS permissions, you should set them in such a

way
that the workbook cannot be modified by any of the users. Because if the
user disables macros, they will be able to do whatever they want with the
workbook (including modifying and resaving).

2. Can I stop user from modifying the file's
properties (eg name) because that might
cause me a few problems!


No. You can protect aspects of the workbook (such as worksheet names,

range
values, etc), but you cannot stop them from renaming the workbook. You
should try to make your code as generic as possible and avoid referring to
workbook and sheet names.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004