Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not reading cells

Status
Not open for further replies.

sineados

Programmer
Oct 17, 2001
34
IE
Hi

I have an Excel Comma seperated values file (A) and a macros file (B). On my machine B reads A perfectly but on another machine B does not read 2 columns which are formatted custom H:mm:ss.

Does anyone know why this would happen, or what I can do to fix it.
 




Hi,

I don't understand how you have a macro file. A WORKBOOK with a macro, yes. Macros cannot be independently run unless you compile and run as an executable.

What do you mean by, "...does not read 2 columns..."

How are you "reading" the csv?

Does it COMPLETELY not import ANYTHING?

Does it "read" but with a different format?

Please post an example of what is happeneing under what conditions.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Yes Sorry I should have done that at the start!. I have a workbook with macros in it.

This is the code
Set m_conXLS = CreateObject("ADODB.Connection")
Set m_rsXLS = CreateObject("ADODB.RecordSet")
Set rs = CreateObject("ADODB.RecordSet")
Set rs1 = CreateObject("ADODB.RecordSet")

sConnection = "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;ReadOnly=True;DBQ=" & wbIT.Name & ";"
m_conXLS.Open sConnection
m_rsXLS.Open "SELECT * FROM [" & wbIT.Sheets(2).Name & "$]", m_conXLS

While Not m_rsXLS.EOF
If IsDate(m_rsXLS.fields(0)) Then
sSQL = "MCK_iqPhoneList '" & m_rsXLS.fields(0) & "','" & m_rsXLS.fields(1) & "','" & m_rsXLS.fields(2) & "'"
objConn.Execute sSQL
End If
m_rsXLS.movenext
Wend

m_rsXLS.fields(1) and m_rsXLS.fields(2) are fields that contain the time.for example below is what I am reading.

Jan 1, 2007 10:03:14 PM 10:03:36 PM


When I print the sSQL statement on my machine its shown as
'Jan 1, 2007','10:03:14 PM','10:03:36 PM'

but on the other machine is 'Jan 1, 2007','',''

thanks
 



This is a VBA Code question that really should be addressed in Forum707.

Please repost in that forum.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top