Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default ADO from .xls to .xlsm file - "Unrecognized database format" e

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!




  #2   Report Post  
Posted to microsoft.public.excel.programming
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!






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default ADO from .xls to .xlsm file - "Unrecognized database format" e

It seems to be the one to use for opening the 2007 files - after getting your
example to work I tweaked it for a while and it's now working correctly with:

"Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & SourceFile & ";" & _
"Extended Properties=Excel 12.0 Xml;"

for .xlsx files and

"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & SourceFile & ";" & _
"Extended Properties=""Excel 8.0;HDR=Yes"";"

for .xls files.

The sample I had at the beginning seemed to imply that which one to use
depended on which version of Excel you were pulling the data _into_, but my
experimenting revealed that it was the _source_ that was important. This may
be obvious to people familiar with ADO, but maybe this will be useful to
someone like me who's just starting with it :)

Thanks again for getting me on the right track.

_________________

"Bob Phillips" wrote:

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!






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
Run Time Error 3343 - Unrecognized database format: Maury Markowitz[_2_] Excel Programming 4 May 29th 08 09:13 AM
Self-Contained "Database" file? woodman650 Excel Programming 2 June 11th 06 09:00 PM
How Can I Update the database file from "Excel" and Built the ent. Kenneth Excel Programming 0 March 11th 05 03:33 AM


All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"