View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default Public Const on a Drive

Good day all,

I have a series of excel files (all inter-linked) located in a folder called
"MasterFolder". Winthin that MasterFolder, I have other secondary folders
(Folder1, Folder2...).

Since all the files within these folders are all linked by macros, I use
Public Const to identify my directories instead of having to retype the full
path. (ie c:\MasterFolder\Folder1\... I would have a :
Public Const MainDrive = "C:\"
Public Const PCFolder = "MasterFolder\Folder1\" etc.).

So I could do things like open file MainDrive + PCFolder + "file.xls"
(c:\MasterFolder\Folder1\file.xls)

The thing is if I install this program on a drive other than the C: drive, I
have to go and modify my Public Const formula to fit the drive it is running
on.

So, Is there a way to formulate my path in a way that I won't declare the
drive but instead it will detect what drive the MfasterFolder is in and use
that drive as it's "drive" by default when my MainDrive constant is
declared.

Regards,

Michel