Set the path

G

Grace

My subroutines open up a lot of files with very specific names. I will be
careful to give those files the right names before starting the macro.

One thing I'm having trouble with is telling it the right path and folder to
look in. Though I could try to automate the pathname too, I am starting to
think that it would be just best to have the macro let me browse to the
folder, WITHOUT even opening a file. can someone suggest some VBA code to
have it let me browse to a folder and then set that folder as the default
place to look for any files I am to LATER open, even the very first one.

Thanks,
Grace
 
G

Grace

OK, I went there. At the bottom, it says:

NOTE:
If you use Excel 2002 you can prompt the user to select a directory by using the new FileDialog object. The advantage is that you can specify a starting directory.

Does this mean that with newer versions of EXCEL (2002 and newer), there is a much easier way? His way looks quite complex.

Also, if there is not a much easier way, I note that that site says
Specifying the starting directory
If you would like to be able to specify the starting directory, things get a lot more complicated.

a.. Download Jim Rech's BrowseForFolder example
But that link is no longer working. Also, I am confused about what the first macro does. Does it just tell you what the current directory is, but doesn't allow you to "specify" the one you want? If so, and if the bottom link doesn't work, I am still out of luck.


Help, anyone!

Grace
 
T

Tom Ogilvy

It allows you to choose the folder - just like you asked.

There is no reason that I can see to set a starting directory as you
described you problem. You want to select a directory and it allows you do
to that.

the link at the bottom would be started as
http://www.bmslt.ie

but as I said, you don't need to specify a starting directory.

there is a new object called filedialog in excel 2002 and later, but then
anyone using the code would need to have xl2002 or later.

the code isn't complex since it already has been written and all you need to
do is paste it into a new module. How complex is that?

--
Regards,
Tom Ogilvy



OK, I went there. At the bottom, it says:

NOTE:
If you use Excel 2002 you can prompt the user to select a directory by using
the new FileDialog object. The advantage is that you can specify a starting
directory.

Does this mean that with newer versions of EXCEL (2002 and newer), there is
a much easier way? His way looks quite complex.

Also, if there is not a much easier way, I note that that site says
Specifying the starting directory
If you would like to be able to specify the starting directory, things get a
lot more complicated.
Download Jim Rech's BrowseForFolder example
But that link is no longer working. Also, I am confused about what the
first macro does. Does it just tell you what the current directory is, but
doesn't allow you to "specify" the one you want? If so, and if the bottom
link doesn't work, I am still out of luck.


Help, anyone!

Grace
 
G

Grace

Yes, it is. Thanks.

Tom Ogilvy said:
It allows you to choose the folder - just like you asked.

There is no reason that I can see to set a starting directory as you
described you problem. You want to select a directory and it allows you do
to that.

the link at the bottom would be started as
http://www.bmslt.ie

but as I said, you don't need to specify a starting directory.

there is a new object called filedialog in excel 2002 and later, but then
anyone using the code would need to have xl2002 or later.

the code isn't complex since it already has been written and all you need to
do is paste it into a new module. How complex is that?

--
Regards,
Tom Ogilvy



OK, I went there. At the bottom, it says:

NOTE:
If you use Excel 2002 you can prompt the user to select a directory by using
the new FileDialog object. The advantage is that you can specify a starting
directory.

Does this mean that with newer versions of EXCEL (2002 and newer), there is
a much easier way? His way looks quite complex.

Also, if there is not a much easier way, I note that that site says
Specifying the starting directory
If you would like to be able to specify the starting directory, things get a
lot more complicated.
Download Jim Rech's BrowseForFolder example
But that link is no longer working. Also, I am confused about what the
first macro does. Does it just tell you what the current directory is, but
doesn't allow you to "specify" the one you want? If so, and if the bottom
link doesn't work, I am still out of luck.


Help, anyone!

Grace
will
 
G

Grace

Unless I'm wrong, if I save the file, this stays as the default path for
every new file I might open. I do NOT want to change my default path, just
to assign one for the current file for the moment. But Tom already gave me
an answer, so I'm Ok now.

Thx,
G
 
Top