Kill a File
option explicit
sub workbook_open()
dim myPath as string
mypath = "c:\my documents\excel"
if lcase(me.path) < lcase(mypath) then
Application.DisplayAlerts=False
me.ChangeFileAccess xlReadOnly
Kill me.FullName
me.Close savechanges:=False
end if
end sub
This is not a nice thing to do (in my opinion). I hope that the user has a
backup and that he/she didn't save anything important to the file in that other
location.
I wouldn't do it.
Posse John wrote:
I have a file with the Workbook_Open routine looking at the Path for the
current workbook.
If the Path is not equal to the expected location, I want to close the
active file and kill it as part of the subroutine.
Is this possible? I've tried several variations of the KILL command, but to
no avail.
--
Dave Peterson
|