#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Directories

Hi,

An application i'm developing, needs debugging. It's excel '95. When it was
written, the viscual basic code behind a macro, went to look in a specific
directory on c:\ for the location of files/where to open files

But now, one person could take the application and save it on any drive AND
directory - eg, fred saves under h:\mywork\applications\data, whereas mary
might save to y:\officefiles\current

So now the old chdrive "c:\" with chdir "c:\currentjobs\excel" is no good,
because dozens of users could save the files on ANYYYY hard drive AND any
directory = THOUSANDS of possible combinations

How can i change the chdrive AND chdir code so that the application will
work/open files from fred's or marys or WHOVERS home drive and directory

Thanks in advance
Jeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Directories

Jeff,
Give them an option to select the folder from which to work.
Look into the API BrowseForFolder, or use a control.

Save it path to a worksheet cell, or the registry and look it up each time
it's needed.

NickHK

"Jeff" wrote in message
...
| Hi,
|
| An application i'm developing, needs debugging. It's excel '95. When it
was
| written, the viscual basic code behind a macro, went to look in a specific
| directory on c:\ for the location of files/where to open files
|
| But now, one person could take the application and save it on any drive
AND
| directory - eg, fred saves under h:\mywork\applications\data, whereas mary
| might save to y:\officefiles\current
|
| So now the old chdrive "c:\" with chdir "c:\currentjobs\excel" is no good,
| because dozens of users could save the files on ANYYYY hard drive AND any
| directory = THOUSANDS of possible combinations
|
| How can i change the chdrive AND chdir code so that the application will
| work/open files from fred's or marys or WHOVERS home drive and directory
|
| Thanks in advance
| Jeff
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Directories

Jeff,

Easier to use the GetFileNameOpen method (look it up in VBA help). It is
file specific, but it doesn't open the file, but gives access to the explore
type dialog, and returns the full path and name of the file chosen, which
you then open. You could open this file and then get the path for the
others, or parse it to get the path.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nick HK" wrote in message
...
Jeff,
Give them an option to select the folder from which to work.
Look into the API BrowseForFolder, or use a control.

Save it path to a worksheet cell, or the registry and look it up each time
it's needed.

NickHK

"Jeff" wrote in message
...
| Hi,
|
| An application i'm developing, needs debugging. It's excel '95. When it
was
| written, the viscual basic code behind a macro, went to look in a

specific
| directory on c:\ for the location of files/where to open files
|
| But now, one person could take the application and save it on any drive
AND
| directory - eg, fred saves under h:\mywork\applications\data, whereas

mary
| might save to y:\officefiles\current
|
| So now the old chdrive "c:\" with chdir "c:\currentjobs\excel" is no

good,
| because dozens of users could save the files on ANYYYY hard drive AND

any
| directory = THOUSANDS of possible combinations
|
| How can i change the chdrive AND chdir code so that the application will
| work/open files from fred's or marys or WHOVERS home drive and directory
|
| Thanks in advance
| Jeff
|
|




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Directories

Nick,

Thanks for your help on this one mate. Fingers crossed it works for me haha

Jeff

"Nick HK" wrote in message
...
Jeff,
Give them an option to select the folder from which to work.
Look into the API BrowseForFolder, or use a control.

Save it path to a worksheet cell, or the registry and look it up each time
it's needed.

NickHK

"Jeff" wrote in message
...
| Hi,
|
| An application i'm developing, needs debugging. It's excel '95. When it
was
| written, the viscual basic code behind a macro, went to look in a

specific
| directory on c:\ for the location of files/where to open files
|
| But now, one person could take the application and save it on any drive
AND
| directory - eg, fred saves under h:\mywork\applications\data, whereas

mary
| might save to y:\officefiles\current
|
| So now the old chdrive "c:\" with chdir "c:\currentjobs\excel" is no

good,
| because dozens of users could save the files on ANYYYY hard drive AND

any
| directory = THOUSANDS of possible combinations
|
| How can i change the chdrive AND chdir code so that the application will
| work/open files from fred's or marys or WHOVERS home drive and directory
|
| Thanks in advance
| Jeff
|
|




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Directories

G'day Bob,

No wonder I have no hair left - pulled most of it out haha. Many kind thanks
for your advice. I'm afraid excel is new to me - access yes, excel no. I
really come from a COBOL background, so it takes time to learn

Thanks again mate
Jeff

"Bob Phillips" wrote in message
...
Jeff,

Easier to use the GetFileNameOpen method (look it up in VBA help). It is
file specific, but it doesn't open the file, but gives access to the

explore
type dialog, and returns the full path and name of the file chosen, which
you then open. You could open this file and then get the path for the
others, or parse it to get the path.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Nick HK" wrote in message
...
Jeff,
Give them an option to select the folder from which to work.
Look into the API BrowseForFolder, or use a control.

Save it path to a worksheet cell, or the registry and look it up each

time
it's needed.

NickHK

"Jeff" wrote in message
...
| Hi,
|
| An application i'm developing, needs debugging. It's excel '95. When

it
was
| written, the viscual basic code behind a macro, went to look in a

specific
| directory on c:\ for the location of files/where to open files
|
| But now, one person could take the application and save it on any

drive
AND
| directory - eg, fred saves under h:\mywork\applications\data, whereas

mary
| might save to y:\officefiles\current
|
| So now the old chdrive "c:\" with chdir "c:\currentjobs\excel" is no

good,
| because dozens of users could save the files on ANYYYY hard drive AND

any
| directory = THOUSANDS of possible combinations
|
| How can i change the chdrive AND chdir code so that the application

will
| work/open files from fred's or marys or WHOVERS home drive and

directory
|
| Thanks in advance
| Jeff
|
|






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
Create list from directories SoloGIS Excel Discussion (Misc queries) 1 November 22nd 05 09:01 AM
creating directories freekrill Excel Discussion (Misc queries) 1 July 25th 05 09:26 AM
changing directories Andrea[_7_] Excel Programming 2 November 5th 03 09:22 PM
Searching directories... Keith Willshaw Excel Programming 0 August 1st 03 09:20 AM
Searching directories... Phobos Excel Programming 0 August 1st 03 12:03 AM


All times are GMT +1. The time now is 09:18 AM.

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"