Identifying the user's drive letter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In all my macros the file references assume that the file structure resides
under the c drive. If I want to distribute these macros what technique do I
need to use so that they can be used by other people who may be on a network
and whose drive letter is unknown to me.
Thank you in advance
 
If they have several drives mapped, how would you know which is their file
drive.

I would add some code that prompts for the user to supply the letter, on
workbook open. Save the value somewhere, a hidden worksheet say, and then
you can check if a value is there, and not prompt again.

Also, think about an option to let them change it.

Either that, or assume nothing, and use GrtOpenFilename to let them pick the
file to open.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
CurDir will tell you the directory they are in now. From that you can
extract the drive letter.

Mike F
 
You must know something about the folder structure.

If you don't, just ask the user to locate the file.

If you do, make some guesses. If they fail, ask the user.

Possible guesses:
check c:\,
identify the drive in curdir
check the drive of the file with the code -- an add-in, I hope
check the drive of the open data file
check the drive of the system folder -- environ("systemroot")

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top