thanks for all of the replies recently. Sorry I haven't responded
sooner, but my wife just gave birth to our son on Sunday, so I've
been a little busy. That said let me answer one of the basic
questions someone brought up:
The purpose of restricting this Excel workbook was to prevent it's
use somewhere else. This is for 2 reasons:
1. I put a lot of time into this and I could say I feel somewhat
selfish about giving away all of my work for free. Granted, until 4
weeks ago I never even recorded a macro, let alone written any VBA
code. I'm sure you guys could have done what I did in much less time,
but...
2. This workbook is used to calculate starting doses of IV
Vancomycin in critically ill patients. This leads to the question of
liability if someone outside of our hospital uses it and something
happens.
Those are the reasons for wanting to limit (impossible to prevent)
it's unauthorized distribution and use. After trying different
things, I decided on using many of the solutions you guys have
proposed. I opened the .XLT file and then saved it as an .XLS file on
the network. Then I made that .XLS file read-only to prevent changes
and password protected the VBA code. This allowed me to verify the
pathname when it is opened, and if not on the correct path, then it
closes. I tried this by moving it off the network drive onto a folder
on the computer. When I ran it from there, it closed as intended. So
that works fine. I might still add the "check if this file exists in
this location" also as a second verification (never know if IT will
create the same Drive, etc at another location). So for now that
problem is taken care of. If I have any problems with the "check if
file exists", I'll be sure to let you know. And based on what I want
to accomplish from above, does this appear to be a satisfactory
solution, or would someone recommend another way? Your help is always
appreciated.