ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying the user's drive letter (https://www.excelbanter.com/excel-programming/344819-identifying-users-drive-letter.html)

Ben

Identifying the user's drive letter
 
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

Bob Phillips[_6_]

Identifying the user's drive letter
 
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)


"Ben" wrote in message
...
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




Mike Fogleman

Identifying the user's drive letter
 
CurDir will tell you the directory they are in now. From that you can
extract the drive letter.

Mike F
"Ben" wrote in message
...
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




Tushar Mehta

Identifying the user's drive letter
 
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

In article ,
says...
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



All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com