Importing Excel files into Access

  • Thread starter Thread starter lcannon1
  • Start date Start date
L

lcannon1

I have been asked to build a database to import files from directorie
(by first browsing the directory) with a lot of
senerios. I have looked at databases already built for purchase (bu
cannot change) that relate to this. And what I have learned is tha
you have to build a program using OLE add-ins ?? to accomplish thi
type of auto import that I know nothing about. Is this too big t
handle for a beginner??? Any suggestions???
 
It would be a difficult task, but not impossible.

Get the code from here and paste it into a module.

http://www.mvps.org/access/api/api0002.htm

now, create a sub with something like:

Public Sub ImportFiles()

dim strDirectory as string
dim strFile as string

strDirectory = BrowseFolder("What Folder you want to
select?")
strFile = dir(strDirectory & "\*.exe")
Do Until strFile = ""
docmd.TransferSpreadsheet ,,strFile,strDirectory & "\" &
strFile
strFile = dir
loop
 
Thanks for the info there!! I have a similar question. I need users t
be able to browse and locate where their Excel file is. thanks for th
info on that!!

Now I also have 3 different named ranges in the Excel file that need t
be imported into 3 different tables (one range for one table). Shoul
I just do the TransferSpreadsheet command for each one? Would tha
work? Or is there something better to do in that situation.

Thanks in advance for any help with this!!

Sarah W
NGI
 
Thanks for the info there!! I have a similar question. I need users t
be able to browse and locate where their Excel file is. thanks for th
info on that!!

Now I also have 3 different named ranges in the Excel file that need t
be imported into 3 different tables (one range for one table). Shoul
I just do the TransferSpreadsheet command for each one? Would tha
work? Or is there something better to do in that situation.

Thanks in advance for any help with this!!

Sarah W
NGI
 
Thanks for the info there!! I have a similar question. I need users t
be able to browse and locate where their Excel file is. thanks for th
info on that!!

Now I also have 3 different named ranges in the Excel file that need t
be imported into 3 different tables (one range for one table). Shoul
I just do the TransferSpreadsheet command for each one? Would tha
work? Or is there something better to do in that situation.

Thanks in advance for any help with this!!

Sarah W
NGI
 
Back
Top