Expected: end of statement Error when using Microsoft.ACE.OLEDB.12.0

I am using Excel 2010 on Windows 7. My objective is to retrieve data from an unopened workbook into the active workbook. I keep getting the message "Compile error: Expected: end of statement". that highlights ".12" right of the "Provider=Microsoft.ACE.OLEDB" part. The code I am using is -

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\users\tony\desktop\driving hours1.xlsx;Extended Properties="Excel 12.0;HDR=No;IMEX=1";

Thanks in advance.

1 answer

Have a look at: http://www.fontstuff.com/ebooks/free/fsadoconnectexcel.pdf

Also, it looks like you have "Excel 12.0" when you should have "Excel 12.0 Xml." Check this page: http://www.connectionstrings.com/excel/