I have about 200 large Excel template (.xltm) files which each contain several tables of data across multiple worksheets. I want to retrieve this data without having to open each file individually, which is very time consuming.
So far, I have been successful at retrieving the data from the same files but saved as macro-enabled workbooks (.xlsm) using the following code:
Set cn = CreateObject("ADODB.Connection")
With cn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\Users\...REPORT TEMPLATE.xlsm" & _
";Extended Properties=""Excel 12.0;HDR=YES;IMEX=1"";"""
However, I get the runtime error message "External table is not in expected format." when I attempt to access the file as a template (.xltm extension), as shown below:
Set cn = CreateObject("ADODB.Connection")
With cn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\Users\...REPORT TEMPLATE.xltm" & _
";Extended Properties=""Excel 12.0;HDR=YES;IMEX=1"";"""
My question: is there a way to use ADODB to retrieve data from a .xltm file in Excel 2007?