MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VBA code to have a user select the directory path to save files in


Posted by Steven on November 26, 2001 10:13 PM

Hi,

I am using the following piece of code to receive the path name from the user.

strSavePath = InputBox("Please enter the full directory path")

I then use the pathname to save various files in the specified directory.

Disadvantage is that typing the full path is easily prone to typing errors.

My question is whether I can ask the user can specify the full path by selecting the path in a window similar to the one which is called using the code:

"Application.GetOpenFilename"

Is this possible ?

Thanks in advance.

Steven


Posted by Robb on November 27, 2001 3:55 AM

Steven

Try:

strFileName = Application.GetSaveAsFilename

This will bring up the SaveAs box. It will get the path/name etx
from the user but will not save the file. You need to use the
information in a further filesave statement.

Any help?

Regards

Robb