Access vba - import excel
Hi there,
I currently have a simple vba function which assists me with importing my excel spreadsheet into pre-defined tables in access. But I want to make it more professional.
This is my current code:
Code:
docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "tblname", "myfilename", True
What I want to happen is once the import button has been clicked a windows folder/dialogue pops up for you to select the file you wish to import.
Is there a way to do this?
Re: Access vba - import excel
try like
vb Code:
myfilename = application.getopenfilename
Re: Access vba - import excel
Hi and thanks for the reply.
How and where would I put this code?
Re: Access vba - import excel
immediately before the docmd line
replace the "myfilename" string in the docmd, with the myfilename variable
you probably need some handling for if the user presses cancel in the dialog