View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
chris100[_78_] chris100[_78_] is offline
external usenet poster
 
Posts: 1
Default Excel file Copy Prevention/Restriction


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)


--
chris100
------------------------------------------------------------------------
chris100's Profile: http://www.excelforum.com/member.php...o&userid=25166
View this thread: http://www.excelforum.com/showthread...hreadid=571307