jfer0x01
asked on
MS Access VBA - User sets output directory for Excel Exports
Hi,
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!
Thanks!
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!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
Lee