Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have about 50 workbooks from which I need to populate the data into Acccess database, Doing it manually would take weeks and it is laborous too. Is it possible to write a Macro to do this job? How can I populate the access database with Data in Sheet1 from all those workbooks into access database? Please Help Thanks in Advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the ACCESS IDE you can use code like this
Function GetData(sFilename, sRange) On Error GoTo ErrorTrap DoCmd.TransferSpreadsheet acImport, 8, "BondTable", sFilename, True, sRange Macro1_Exit: Exit Function ErrorTrap: MsgBox Error$ Resume Macro1_Exit End Function as you can see, you pass the filepath/name and the range build a table with two columns the first is the filepath, the second is the name, then iterate through it,calling the function each iteration "sam" wrote: Hi All, I have about 50 workbooks from which I need to populate the data into Acccess database, Doing it manually would take weeks and it is laborous too. Is it possible to write a Macro to do this job? How can I populate the access database with Data in Sheet1 from all those workbooks into access database? Please Help Thanks in Advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Per sam:
How can I populate the access database with Data in Sheet1 from all those workbooks into access database? My first try would be per Patrick's suggestion. But I'd be ready for inconsistencies in the layouts and data on the sheets - as in dollar amounts in most cells of a "Market Value" column, but occasionally something like "No data available, call Chris." Another potential problem is header rows - the bane of most imports I've done, especially when they contain information that is vital to understanding the rows under them. If it were too bad, I'd write a generic routine to go through a named sheet row-by-row, column-by-column writing whatever was found to a series of String fields in a temporary table and then proceed to cleaning up the data in the temporary table. If there were a lot of header rows, I'd circle back and modify that generic routine to look for this and that value.... -- PeteCresswell |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP: VBA Code to extract data from an SQL Server database and put it into Access Database | Excel Programming | |||
Macro to Export Selected fields to an Existing Access Database | Excel Programming | |||
How to create lists of data quickly from a pre-existing database | Excel Discussion (Misc queries) | |||
Data From Excel Range To Existing Access Table | Excel Programming | |||
vb code to export data into existing Access table | Excel Programming |