In Access (2016), I am trying to import various Excel files from vendors we use at my work. Their formats are all different, so I need to setup a specific saved import within Access for each one. I then want the users to be able to click the import button, and the excel file be imported to the database.
I initially used the Runsavedimportexport
command, but that has a static file path and I don't fully understand transferspreadsheet
to be able to use it.
My question is this, how can I use FileDialog
to open the file selector, let my users select a file (probably from the desktop), then save that as a variable to run CopyFile
. After CopyFile
runs and pastes the copy, rename to a specific name, run runsavedimportexport
then delete the file.
I have found all the various arguments for each code, but am struggling to tie it all together.
So far all I have managed to put together is
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
f.Show