View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel data into VB 6.0

Here is a guy posting a couple of screens above this thread that seems to
have had a similar problem as you - then he says:

-------------------------
From: Goh Siang Hwee
References:
Subject: ado problem in excel
Message-ID:
Newsgroups: microsoft.public.excel.programming
Date: Wed, 27 Aug 2003 20:35:46 -0700

Hi, thanks Rob. I have solved my problem by using other way. I set the
connection string "Extended Properties" to IMEX=1 and all the problem
solved.

Thanks anyway.
Really appreciate for your help.

Regards,
Goh Siang Hwee


-------------------------

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
http://support.microsoft.com/default...b;en-us;257819
HOWTO: Use ADO with Excel Data from Visual Basic or VBA


It discusses this down around the middle of the article. talks about an
extended property of IMEX=1

To work around this problem for read-only data, enable Import Mode by

using
the setting "IMEX=1" in the Extended Properties section of the connection
string. This enforces the ImportMixedTypes=Text registry setting. However,
note that updates may give unexpected results in this mode. For additional
information about this setting, click the article number below to view the
article in the Microsoft Knowledge Base:
194124 PRB: Excel Values Returned as NULL Using DAO OpenRecordset



--

Regards,

Tom Ogilvy




"Tom Ogilvy" wrote in message
...
Maybe some useful information he

http://support.microsoft.com/default...b;en-us;257819
HOWTO: Use ADO with Excel Data from Visual Basic or VBA

--
Regards,
Tom Ogilvy


"Eric" wrote in message
...
Open as in Open with the Excel Application? No, I need to read it in

using
VB. I don't know any way to read the data into VB other than those

ADO
commands. Does Excel have a spreadsheet to text conversion from a DOS
prompt? The VB program is to be a process which can convert the
spreadsheets to text files; to be called from another application,

which
can
then read in the text file. The other application cannot read in

Excel
spreadsheets. If there's a DOS command that can convert Excel to

text,
that
might work, though the VB would still be nice as it can manipulate the

text
as it writes it out if necessary.

I tried using a different connection string (below) to avoid using

ADO,
but
that got the same results. I would need to know different commands to

pull
in the data it seems.

oConn.Open "Provider=MSDASQL.1;Persist Security Info=False;" & _
"Extended Properties=DBQ=" & filename & ";" & _
"DefaultDir=" & pathname & ";" & _
"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;FIL=excel

8.0;"
&
_




"MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;Re adOnly=0;SafeTransactions=
0;" & _
"Threads=3;UID=admin;UserCommitSync=Yes;"

"Bob Phillips" wrote in message
...
Eric,

This is due to the way the query 'assumes' the data type I believe.

So,
your
data is such that it is pre-dominantly text, so it is all assumed as

text.

But why use ADO, why not just open the Excel workbook and write it

as
a
text
file?

--

HTH

Bob Phillips