adodb.Connection execute to Excel 12.0 from vb script

P

Per

I am trying to get information about users from an excel file. i am having
problems with command execute. it worked perfectly before on my clients
older pcs which had office 2000 on but upgraded to 2007. now on a new
installed pc i get :"object required" when the script tries to execute the
command with the sql. I do not know where to start looking. what is missing?
The OS is win xp pro and Office is 2007


CODE: set conn= Createobject("ADODB.Connection")
sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sDBPath & ";" & _
"Extended Properties=""Excel 12.0;HDR=YES"""


conn.open sConn

sSQL = "Select * from [Login$]"
set rsUser = conn.Execute(sSQL)


this is not returning any rows but it did before.
 
N

Norman Yuan

Are you reading from Excel 2007 file (*.xlsx, *.xlsm...)? Does the running
computer has Access2007 installed (hence Microsoft.ACE.OLEDB.12.0 provider,
which does not come with OS as old Jet Engine, you need to have it by
installing Access2007, or download it from MS).

If it is regular *.xls file (Excel2003 or older), try to use old, good Jet
OLEDB provider and set "Extended Properties=Excel 8.0;"
 
P

Per

the file is xlsx. the computers does not have access2007 installed.
i have also tried with Jet oledb provider against an xls file with the same
result.

it seems like i can open the connection but not execute my sql to my
recordset.

what dll files should i look for so i know that everything is in place?

"Norman Yuan" skrev:
Are you reading from Excel 2007 file (*.xlsx, *.xlsm...)? Does the running
computer has Access2007 installed (hence Microsoft.ACE.OLEDB.12.0 provider,
which does not come with OS as old Jet Engine, you need to have it by
installing Access2007, or download it from MS).

If it is regular *.xls file (Excel2003 or older), try to use old, good Jet
OLEDB provider and set "Extended Properties=Excel 8.0;"


Per said:
I am trying to get information about users from an excel file. i am having
problems with command execute. it worked perfectly before on my clients
older pcs which had office 2000 on but upgraded to 2007. now on a new
installed pc i get :"object required" when the script tries to execute the
command with the sql. I do not know where to start looking. what is
missing?
The OS is win xp pro and Office is 2007


CODE: set conn= Createobject("ADODB.Connection")
sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sDBPath & ";"
& _
"Extended Properties=""Excel 12.0;HDR=YES"""


conn.open sConn

sSQL = "Select * from [Login$]"
set rsUser = conn.Execute(sSQL)


this is not returning any rows but it did before.
 
N

Norman Yuan

If ther is no Access2007 installed, it is likely the computer does not have
MS ADE OLEDB 12.0 provider installed.

You can go to "Add/remove programs" window to verify it: if installed, you
should be able to find one item called "Microsoft Office Access database
engine 2007".

To download it:

http://www.microsoft.com/downloads/...36-8C28-4598-9B72-EF94E038C891&displaylang=en



Per said:
the file is xlsx. the computers does not have access2007 installed.
i have also tried with Jet oledb provider against an xls file with the
same
result.

it seems like i can open the connection but not execute my sql to my
recordset.

what dll files should i look for so i know that everything is in place?

"Norman Yuan" skrev:
Are you reading from Excel 2007 file (*.xlsx, *.xlsm...)? Does the
running
computer has Access2007 installed (hence Microsoft.ACE.OLEDB.12.0
provider,
which does not come with OS as old Jet Engine, you need to have it by
installing Access2007, or download it from MS).

If it is regular *.xls file (Excel2003 or older), try to use old, good
Jet
OLEDB provider and set "Extended Properties=Excel 8.0;"


Per said:
I am trying to get information about users from an excel file. i am
having
problems with command execute. it worked perfectly before on my
clients
older pcs which had office 2000 on but upgraded to 2007. now on a new
installed pc i get :"object required" when the script tries to execute
the
command with the sql. I do not know where to start looking. what is
missing?
The OS is win xp pro and Office is 2007


CODE: set conn= Createobject("ADODB.Connection")
sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sDBPath &
";"
& _
"Extended Properties=""Excel 12.0;HDR=YES"""


conn.open sConn

sSQL = "Select * from [Login$]"
set rsUser = conn.Execute(sSQL)


this is not returning any rows but it did before.
 
P

Per

Thanks for your help Norman. But this problem is very strange, i have talked
with the company that manage my clients computers. My solution works on half
of their pcs. they are running a microsoft installation program. They do not
have any clue why it sometimes work and sometimes dont. And i do not know
what dlls to look for if maybe they are not properly registrered? I do not
think Acces engine is installed, but still it works on half of their
computers. Any clues?

regards,
/Per

"Norman Yuan" skrev:
If ther is no Access2007 installed, it is likely the computer does not have
MS ADE OLEDB 12.0 provider installed.

You can go to "Add/remove programs" window to verify it: if installed, you
should be able to find one item called "Microsoft Office Access database
engine 2007".

To download it:

http://www.microsoft.com/downloads/...36-8C28-4598-9B72-EF94E038C891&displaylang=en



Per said:
the file is xlsx. the computers does not have access2007 installed.
i have also tried with Jet oledb provider against an xls file with the
same
result.

it seems like i can open the connection but not execute my sql to my
recordset.

what dll files should i look for so i know that everything is in place?

"Norman Yuan" skrev:
Are you reading from Excel 2007 file (*.xlsx, *.xlsm...)? Does the
running
computer has Access2007 installed (hence Microsoft.ACE.OLEDB.12.0
provider,
which does not come with OS as old Jet Engine, you need to have it by
installing Access2007, or download it from MS).

If it is regular *.xls file (Excel2003 or older), try to use old, good
Jet
OLEDB provider and set "Extended Properties=Excel 8.0;"


I am trying to get information about users from an excel file. i am
having
problems with command execute. it worked perfectly before on my
clients
older pcs which had office 2000 on but upgraded to 2007. now on a new
installed pc i get :"object required" when the script tries to execute
the
command with the sql. I do not know where to start looking. what is
missing?
The OS is win xp pro and Office is 2007


CODE: set conn= Createobject("ADODB.Connection")
sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sDBPath &
";"
& _
"Extended Properties=""Excel 12.0;HDR=YES"""


conn.open sConn

sSQL = "Select * from [Login$]"
set rsUser = conn.Execute(sSQL)


this is not returning any rows but it did before.
 
N

Norman Yuan

In your code, if you code the ConnectionString like:

sconn = "Provider=Microsoft.ACE.OLEDB.12.0;...."

then, the running computer must have either MS Access2007 installed, or MS
Office Aceess Database Engine 2007 installed.

Are you sure your ConnectionString uses "Microsoft.ACE.OLEDB.12.0;...."?



Per said:
Thanks for your help Norman. But this problem is very strange, i have
talked
with the company that manage my clients computers. My solution works on
half
of their pcs. they are running a microsoft installation program. They do
not
have any clue why it sometimes work and sometimes dont. And i do not know
what dlls to look for if maybe they are not properly registrered? I do not
think Acces engine is installed, but still it works on half of their
computers. Any clues?

regards,
/Per

"Norman Yuan" skrev:
If ther is no Access2007 installed, it is likely the computer does not
have
MS ADE OLEDB 12.0 provider installed.

You can go to "Add/remove programs" window to verify it: if installed,
you
should be able to find one item called "Microsoft Office Access database
engine 2007".

To download it:

http://www.microsoft.com/downloads/...36-8C28-4598-9B72-EF94E038C891&displaylang=en



Per said:
the file is xlsx. the computers does not have access2007 installed.
i have also tried with Jet oledb provider against an xls file with the
same
result.

it seems like i can open the connection but not execute my sql to my
recordset.

what dll files should i look for so i know that everything is in place?

"Norman Yuan" skrev:

Are you reading from Excel 2007 file (*.xlsx, *.xlsm...)? Does the
running
computer has Access2007 installed (hence Microsoft.ACE.OLEDB.12.0
provider,
which does not come with OS as old Jet Engine, you need to have it by
installing Access2007, or download it from MS).

If it is regular *.xls file (Excel2003 or older), try to use old, good
Jet
OLEDB provider and set "Extended Properties=Excel 8.0;"


I am trying to get information about users from an excel file. i am
having
problems with command execute. it worked perfectly before on my
clients
older pcs which had office 2000 on but upgraded to 2007. now on a
new
installed pc i get :"object required" when the script tries to
execute
the
command with the sql. I do not know where to start looking. what is
missing?
The OS is win xp pro and Office is 2007


CODE: set conn= Createobject("ADODB.Connection")
sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sDBPath
&
";"
& _
"Extended Properties=""Excel 12.0;HDR=YES"""


conn.open sConn

sSQL = "Select * from [Login$]"
set rsUser = conn.Execute(sSQL)


this is not returning any rows but it did before.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top