+ Reply to Thread
Results 1 to 19 of 19

Excel file Copy Prevention/Restriction

  1. #1
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143

    Excel file Copy Prevention/Restriction

    I have an excel file which i've spent blooming ages working on, and now that i've come to implement this in our works shop i don't want any employee copying this file from the computer taking in home, messing around with it and cracking passwords etc etc...

    Solutions to this are few and far between. I tried download.com for anything but all i could find was software to prevent unauthorised copying of .exe files.
    Searching the forums here it seems the concensus is that you can't prevent copying of an excel file, just make it a lot harder.

    So, i'd like it if anyone had any ideas to post here so i can make it as difficult as possible for someone to copy an excel file.

    Dave Peterson suggested a macro to check the file path and if it was incorrect then fail to proceed etc...

    http://www.excelforum.com/showthread...revention+file

    I've seen solutions for having a blank page startup unless with worksheets very hidden unless a password is entered correctly.

    These make it difficult to use an excel file once it has been taken away, but doesn't make it difficult to copy in the first place.

    For my own suggestion i'd say have a file that is just once opened, requests a password and then opens the correct file from a hidden location (i'm sure i've seen this suggested before). This makes it a little harder to copy. But, I'd like to take this one step further.
    Is it possible to prevent the search facilty in windows? Because the problem with the method above is that someone only needs to search hidden folders/files to find the file.

    I'm all out of suggestions. Anyone else???

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Chris here's a link to where i posed the question http://www.excelforum.com/showthread.php?t=553507 or you could try coding in your Auto_open the exact file path i.e if thisworkbook.path <> "and then put in your filepath to an obscure named folder perhaps" then KillActive

    Try this below, its not fool proof but you can set the file path and if the workbook is opened not in the specified path it will delete itself!

    However, deleting something on another persons computer is classed as "virus activity" and should not be carried out without you stating your intentions!

    Sub Auto_Open()
    If Thisworkbook.Path <> "YOUR PATH HERE" Then
    Call KillActive
    End If
    End Sub

    Sub KillActive()
    dim sName as String
    On Error Resume Next
    sName = ThisWorkbook.FullName
    Application.DisplayAlerts = False
    ThisWorkbook.ChangeFileAccess xlReadOnly
    Kill sName
    Application.DislayAlerts = True
    ThisWorkbook.Close SaveChanges:=False
    End Sub

  3. #3
    Jean-Yves
    Guest

    Re: Excel file Copy Prevention/Restriction

    Hello Chris,

    Save as PDF ?
    as far as security ins concerned, better don't use excel then.

    Regards

    JY

    "chris100" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have an excel file which i've spent blooming ages working on, and now
    > that i've come to implement this in our works shop i don't want any
    > employee copying this file from the computer taking in home, messing
    > around with it and cracking passwords etc etc...
    >
    > Solutions to this are few and far between. I tried download.com for
    > anything but all i could find was software to prevent unauthorised
    > copying of .exe files.
    > Searching the forums here it seems the concensus is that you can't
    > prevent copying of an excel file, just make it a lot harder.
    >
    > So, i'd like it if anyone had any ideas to post here so i can make it
    > as difficult as possible for someone to copy an excel file.
    >
    > Dave Peterson suggested a macro to check the file path and if it was
    > incorrect then fail to proceed etc...
    >
    > http://www.excelforum.com/showthread...revention+file
    >
    > I've seen solutions for having a blank page startup unless with
    > worksheets very hidden unless a password is entered correctly.
    >
    > These make it difficult to use an excel file once it has been taken
    > away, but doesn't make it difficult to copy in the first place.
    >
    > For my own suggestion i'd say have a file that is just once opened,
    > requests a password and then opens the correct file from a hidden
    > location (i'm sure i've seen this suggested before). This makes it a
    > little harder to copy. But, I'd like to take this one step further.
    > Is it possible to prevent the search facilty in windows? Because the
    > problem with the method above is that someone only needs to search
    > hidden folders/files to find the file.
    >
    > I'm all out of suggestions. Anyone else???
    >
    >
    > --
    > chris100
    > ------------------------------------------------------------------------
    > chris100's Profile:
    > http://www.excelforum.com/member.php...o&userid=25166
    > View this thread: http://www.excelforum.com/showthread...hreadid=571307
    >




  4. #4
    Jean-Yves
    Guest

    Re: Excel file Copy Prevention/Restriction

    HI again,
    Your suggestion :
    >For my own suggestion i'd say have a file that is just once opened,
    > requests a password and then opens the correct file from a hidden
    > location (i'm sure i've seen this suggested before). This makes it a

    Remove the .xls extention from your hidden location or even rename it before
    opening it. (just to try confusing people)
    Regards
    JY

    "chris100" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have an excel file which i've spent blooming ages working on, and now
    > that i've come to implement this in our works shop i don't want any
    > employee copying this file from the computer taking in home, messing
    > around with it and cracking passwords etc etc...
    >
    > Solutions to this are few and far between. I tried download.com for
    > anything but all i could find was software to prevent unauthorised
    > copying of .exe files.
    > Searching the forums here it seems the concensus is that you can't
    > prevent copying of an excel file, just make it a lot harder.
    >
    > So, i'd like it if anyone had any ideas to post here so i can make it
    > as difficult as possible for someone to copy an excel file.
    >
    > Dave Peterson suggested a macro to check the file path and if it was
    > incorrect then fail to proceed etc...
    >
    > http://www.excelforum.com/showthread...revention+file
    >
    > I've seen solutions for having a blank page startup unless with
    > worksheets very hidden unless a password is entered correctly.
    >
    > These make it difficult to use an excel file once it has been taken
    > away, but doesn't make it difficult to copy in the first place.
    >
    > For my own suggestion i'd say have a file that is just once opened,
    > requests a password and then opens the correct file from a hidden
    > location (i'm sure i've seen this suggested before). This makes it a
    > little harder to copy. But, I'd like to take this one step further.
    > Is it possible to prevent the search facilty in windows? Because the
    > problem with the method above is that someone only needs to search
    > hidden folders/files to find the file.
    >
    > I'm all out of suggestions. Anyone else???
    >
    >
    > --
    > chris100
    > ------------------------------------------------------------------------
    > chris100's Profile:
    > http://www.excelforum.com/member.php...o&userid=25166
    > View this thread: http://www.excelforum.com/showthread...hreadid=571307
    >




  5. #5
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Hi guys,

    Thanks for the suggestions.
    With regards to changing the file extension, i'm not sure how i could do that and still open the file to run normally. I tried messing around with saving as different extensions but with no luck.

    Mr llyod, i like your method and i'm going to try after i finish this post. Fortunately the files we use are all in house so we can ignore the whole virus thing.

    Thanks again.

  6. #6
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Simon,

    I tried the "kill" method which i thought was pretty good. I changed the file path as directed but although it killed the file in any different directory, it also killed it when i tried to open the file in the correct directory!

    I'm no where near an expert at VBA so here is the line of code i used in case i spazzed somewhere:

    If ThisWorkbook.Path <> "C:\Documents and Settings\Owner\Desktop\TESTDELETE.xls" Then

    Opening the file from that location killed it. Please let me know where i'm going wrong.

    Regards,

    Chris

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Chris i read your line and cant imagine that your user name or your area n the computer is called owner so i assume thats why it deleted the file, try just dropping the "Owner" portion of your path, but you should save it in a folder on the desktop because that folder will not exist on your users desktop!

    Just a thought,

    Regards,
    Simon

  8. #8
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    hi Simon,

    Tried what you said but same result. I'll play around with it in the morning and see if something else works.

    regards

    chris

  9. #9
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Just spent a bit of time messing around with this. Really odd. I used the code below to test and although it ran through to KillActive in a different directory, it also did the same in the correct directory.

    Sub Auto_Open()
    If ThisWorkbook.Path <> "C:\Documents and Settings\OWNER\Desktop\Book2.xls" Then
    Call KillActive
    End If
    End Sub

    Sub KillActive()
    MsgBox ("heelo")
    End Sub

    I checked the file path by copying and pasting into Run and it opened the file fine.

    Any ideas, thoughts, suggestions and otherwise help on a postcard please.

    Thanks

    Chris

  10. #10
    Jean-Yves
    Guest

    Re: Excel file Copy Prevention/Restriction

    Hi Chris,

    Change :
    If ThisWorkbook.Path <> "C:\Documents and Settings\OWNER\Desktop\Book2.xls"
    To
    If ThisWorkbook.Path <> "C:\Documents and Settings\OWNER\Desktop"
    Regards
    JY

    "chris100" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Just spent a bit of time messing around with this. Really odd. I used
    > the code below to test and although it ran through to KillActive in a
    > different directory, it also did the same in the correct directory.
    >
    > Sub Auto_Open()
    > If ThisWorkbook.Path <> "C:\Documents and
    > Settings\OWNER\Desktop\Book2.xls" Then
    > Call KillActive
    > End If
    > End Sub
    >
    > Sub KillActive()
    > MsgBox ("heelo")
    > End Sub
    >
    > I checked the file path by copying and pasting into Run and it opened
    > the file fine.
    >
    > Any ideas, thoughts, suggestions and otherwise help on a postcard
    > please.
    >
    > Thanks
    >
    > Chris
    >
    >
    > --
    > chris100
    > ------------------------------------------------------------------------
    > chris100's Profile:
    > http://www.excelforum.com/member.php...o&userid=25166
    > View this thread: http://www.excelforum.com/showthread...hreadid=571307
    >




  11. #11
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Thanks Jean-Yves.

    I tried what you suggested but still no luck. Could or or anyone else give this a go to see if it works?

    I'm lost!!

    Regards,

    Chris

  12. #12
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Having a look around i found this piece of code submitted by Dave Peterson:

    http://www.excelforum.com/showthread...heck+path+file

    option explicit
    sub workbook_open()

    dim myPath as string
    mypath = "c:\book2"

    if lcase(me.path) <> lcase(mypath) then
    Application.DisplayAlerts=False
    me.ChangeFileAccess xlReadOnly
    Kill me.FullName
    me.Close savechanges:=False
    end if

    end sub

    Working with the above i took the filename back to basics and just kept it on the C:\ location. It didn't kill the file in the correct location but nor did it kill in a different location!

    What the hell have i done to screw this up?

    I'm confused....

    P.s obviously be careful using the above code on anything you want to keep (doh)

  13. #13
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Chris looking at the code it changes the file to read only!, does the file left on your computer say read only on the top left when you open it?

    Regards,
    Simon

  14. #14
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Hi Simon,

    No it doesn't change to read only when opening in the correct or incorrect location.

    Someone hit me with a ficky stick.

    Regards,

    Chris

  15. #15
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Sorted Chris!, you had the filename in the wrong place and of course if your using XP, ME, 2000 you have a username which of course was missing and thats why it would delete anywhere heres the revised code substitute your own criteria.....P.S i think the folder name is case sensitive too!

    Regards,
    Simon

    Option Explicit

    Sub Auto_Open()
    If ThisWorkbook.Path = "C:\Documents and Settings\Simon\Desktop\Testit" Then
    Exit Sub
    ElseIf ThisWorkbook.Path <> "C:\Documents and Settings\Simon\Desktop\Testit" Then
    Call KillActive
    End If
    End Sub

    Sub KillActive()
    Dim sName As String
    On Error Resume Next
    sName = ThisWorkbook.FullName
    Application.DisplayAlerts = False
    ThisWorkbook.ChangeFileAccess xlReadOnly
    Kill sName
    Application.DislayAlerts = True
    ThisWorkbook.Close SaveChanges:=False
    End Sub

  16. #16
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Thanks Simon but for some reason it doesn't work. I'm about to kill the computer instead!

    What i'll do is try it out on a different computer if for some reason that will make a difference......ummh.

    If i haven't thrown the computer out of the window i'll post the result.

    Thanks & Regards,

    Chris

  17. #17
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Well Chris it worked fine for me, created a folder called Testit and saved the workbook in there i then copied the workbook and placed it on the desktop, when i opened the one on the desktop it got deleted but when i opened the workbook in the folder Testit it did not get deleted. I can't understand whats going on with yours?

    regards,
    Simon

  18. #18
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Ok Simon, I think i've almmost clocked it.

    I was confused thinking that "Testit" in your code was the filename! I have it now that it works with basic folders e.g c:\Testit\Test2.

    I having tested it extensively but i'm pretty sure that was causing the problem.

    Thank you very very very much Simon and others.

    You can definately hit me with that Ficky Stick....

    Thanks again and regards,

    Chris

  19. #19
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Consider yourself severly whacked!

    Regards,
    Simon

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1