InputBox for folder path


Posted by Alexia on January 03, 2002 7:17 PM

If I have the following:

strFolder As String
strFolder=InputBox("Please enter folder","Path")

but I don't want the user to have to enter the entire path, is there any way to set it up so that the user can just type Marketing instead of C:\My Documents\PurchaseOrders\2002\Marketing?

In other words, can I set the macro up so that entering Marketing is the same as entering the above path?

Thanks :-)

Posted by Scott on January 03, 2002 7:50 PM

You could use something like:

Workbooks.Open Filename:=Range("A1")

and use a cell for the path and file name. You could use concatenation to insert the folder name into a pre-determined path (fed from a user input form, or another cell).

Posted by Bruno on January 04, 2002 12:33 AM

Hi Alexia,

Maybe the answer of Scott is all you need, but :

It is also possible to fill a list box with the folders of a certain path. (I've used this in a recent project.)

Let me know if this is what you are looking for and I paste the vba code here.

Bruno
-----


Posted by Gary on January 04, 2002 12:48 AM

You could try this:

strFolder as String
strFolder=InputBox("Please enter folder","Path")
Workbooks.Open Filename:="C:\My Documents\PurchaseOrders\2002\" & strFolder

Posted by Alexia on January 04, 2002 6:59 AM

Scott's idea would probably work brilliantly, except that I'm not sure how to proceed. I like this idea of using a list box and would greatly appreciate it if you helped me out with the code. Thanks :-) Hi Alexia, Maybe the answer of Scott is all you need, but : It is also possible to fill a list box with the folders of a certain path. (I've used this in a recent project.) Let me know if this is what you are looking for and I paste the vba code here. Bruno


Posted by Bruno on January 06, 2002 12:16 AM

OK Alexia, wait only until monday please because I don't have the code @ home :-)
I will post it here.
Bruno Scott's idea would probably work brilliantly, except that I'm not sure how to proceed. I like this idea of using a list box and would greatly appreciate it if you helped me out with the code. Thanks :-) : Hi Alexia, : Maybe the answer of Scott is all you need, but



Posted by Bruno on January 07, 2002 12:38 AM

Alexia see :
13383.html