Hi Chris,
It is nearly always possible but to recommend a best course of action I
would have to know more about what tables, what worksheets, workbooks are
involved.
Are you wanting to import every column of data contained in each worksheet,
more than one worksheet per workbook, how consistent are the workbook names?
How consistent are the worksheet formats? Is this all going into one table
or does each column arrangement have a corresponding table of its own? How
many rows of data in each worksheet?
Let's assume you only want certain fields/columns and their header in the
worksheet is always the same, although the individual worksheets may contain
various other columns in various ordinal positions, but we never have more
than 50 or 100 rows of data in any given worksheet.
In this case, I would create an import folder, put all my to be imported
workbooks in that folder, opt for using the Excel Application object to
literally read the header rows of each worksheet in the target workbooks.
If I find my headers/column/field names then I would save the col positions
of each field I want, probably use a variant array. I would plow down the
rows until I found an empty row, save that row count as my last row of data
(-1).
Then I would stuff the column data I wanted into my array - open up my
target table and insert the array values in the appropriate fields, close
the target, clear the array, check the next worksheet, repeat until I run
out of worksheets, check the next workbook until I run out of workbooks.
Hope this gives you some ideas,
Gordon