View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default ADO from .xls to .xlsm file - "Unrecognized database format" e

You were trying to use the Microsoft.ACE.OLEDB.12.0 OLE DB provider, I must
admit I haven't come across that one before.

--
__________________________________
HTH

Bob

"Tara H" wrote in message
...
Thanks Bob, I'm still not really sure where I was going wrong - it may
have
been in the format of the connection string, but when I copied yours it
worked ok and got me past this blockage.
Thanks for the help!

"Bob Phillips" wrote:

This works okay for me

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sFilename & ";" & _
"Extended Properties=Excel 8.0;"



--
__________________________________
HTH

Bob

"Tara H" wrote in message
...
I'm trying to use ADO to pull data from a .xls file into a .xlsm file
in
Excel 2007. Whatever I do gives me the error:

Run-time error '-2147467259 (80004005)':
Unrecognized database format

I've searched for this and found some results relating to corrupted
files,
but I doubt this can be the case - I've tried it with a number of
different
input files and even created one by hand from scratch to test with.

I've tried many different samples of code that I've found on this
forum,
and
each of them gives the same error at the 'cn.open' point. The
connection
string I'm currently using is:

cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data
Source=C:\temp\testbook.xls;"

I'm not entirely sure if I'm using the right driver and references,
since
I
haven't been able to find an example of my exact situation.

Any guidance would be very gratefully received - I've been tearing my
hair
out over this and making no progress!