MS Access VBA - User sets output directory for Excel Exports


I have many Queries that Excel Exports to an .xls, at a determined directory, like so,

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "ASP", "C:\Databases\Access to Excel.xls", True

This executes when a user pushes a button on a form.

Now, i need to substitute my  Path,  "C:\Databases\Access to Excel.xls", with a Variable

let say "Dim OutPutPath", And let the user select the output directory, via windows explorer,

so it copies the path information the user selected to my "OutPutPath" variable, since I need to export over 30 queries to Excel this way,and their is no way we can select the same directory in real time, 30 times!

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
see this sample db

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Option 1: User uses Windows Explorer and navigates the path, copies the path, and pastes the path into an unbound textbox on the same form as the export button. You can then do something like this near the top of your sub
OutPutPath = txtCopiedPath <-- the name of the unbound textbox
Option 2: Use the CommonDialog Class under ActiveX Controls
Option 3: Use a tedious combination of comboboxes and listboxes and events - not recommended
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.