Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Public Const on a Drive

Why not use a property instead. i.e.

Public Property Get MainDrive() As String
MainDrive = Left(Environ("windir"), 3)
End Property


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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional format to highlight only cells with formula, not const hkbarnett Excel Worksheet Functions 2 November 19th 09 01:49 AM
Links to mapped drive change to refer to local hard drive SueD Links and Linking in Excel 1 May 8th 08 11:42 AM
crash changing const to public const BrianB Excel Programming 0 August 4th 03 10:13 AM
Pasting a range of information from a foler on F Drive to another folder on same drive Tom Ogilvy Excel Programming 1 August 3rd 03 01:50 AM
XLL - VS .Net2003 - init problem - const char strings - /Gf option?? Kevin Love Excel Programming 0 July 27th 03 11:32 PM


All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"