View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
okrob okrob is offline
external usenet poster
 
Posts: 142
Default Prompt user to select directory

On Mar 2, 12:38 pm, "Dan R." wrote:
I'm using this to open a wb on a shared network drive: Set wb =
Workbooks.Open("N:\CP H6 Lookup.xls"). But if for some reason the user
has this drive mapped on O: it's obviously going to error out b/c it
can't find the file, so what can I add to this so that if it does
error out it will prompt the user to select the appropriate directory
containing this file?

Thanks,
-- Dan


Use the actual computer name instead of a drive letter. If it's a
network drive, it's probably called something else anyway. Go to your
drive list (my computer) and check the network / computer name for the
drive letter. In most cases, clicking the Tools-Disconnect Network
Drive... will show you the currently designated drive letters and
their real names. (be sure not to actually do the disconnect!)
then replace your drive letter with the actual path.
N: is replaced ...
maybe N is mapped to \\computername\
maybe it is mapped to a folder under that e.g. \\computername\folder
\folder\
either way, it'll work no matter what the drive letter is that's
mapped.