Thanks for pointing me in the right direction, I'm pretty sure that the "Copy
a range from all files in a folder" (Example_4) should give me what I need,
but I must be doing something wrong.
I'm running the application from a command button on an Access form and I've
referenced both the Microsoft ActiveX Data Objects 2.5 Library and the
Microsoft Excel 11.0 Object Library. The Excel workbooks have been placed
into a file C:\Data and the Example_4 code has been placed in the Click event
of a command button on the form, while the functions and GetData macro have
been placed in an Access module (Module1).
However the Application.ScreenUpdating method fails when I run the code, and
if this code is commented out then the Activeworkbook.Worksheets.Add method
fails and no new workbook is opened or updated. (I actually want the data
inserted into an Access table - the consolidated new workbook is just an
interim step in the process prior to importing it into Access).
Also the range of the data to import from each file varies according to the
number of records on each individual Excel worksheet selected. How do I get
around this?
Or am I on the wrong track and should I maybe be using one of the other
examples? Thanks for your help.