You can put the code really any place. For example you can put it in
the workbook open command and automatically close the workbook if the
file is in the wrong location. You can put it in the code where the
form is opened.
If you add to your code this message box
msbbox(thisworkbook.Fullname)
Then you put a test in your macro to disble or close the workbook if
the FullName doesn't equal some known value
if thisworkbook.Fullname < "h:\Myfolder\book1.xls" then
thisworkbook.close savechanges :=false
end if
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=180187
Microsoft Office Help